I have this code below where I fetch a object 'yogaSpaceEvent' from the DB as a entity. I want to save the values before I modify anything and then pass the old values (as a object) and the object with the newly saved values to another method 'getEditedEventEmail' to do some logic. But the 'oldEvent' object has all the new values of 'newEvent'.
YogaSpaceEvent yogaSpaceEvent = yogaSpace.YogaSpaceEvents.Where(k => k.YogaSpaceEventId == details.EventId).First();
if (yogaSpaceEvent == null)
throw new Exception("You Don't Have A Yoga Space Event With This ID!");
YogaSpaceEvent oldEvent = yogaSpaceEvent; // save all the old values in this object
var displayedTime = details.StartTime.GetType().GetMember(details.StartTime.ToString()).First().GetCustomAttribute<DisplayAttribute>().Name;
yogaSpaceEvent.EventDateTime = details.EventDate.AddHours(DateTime.Parse(displayedTime).Hour).AddMinutes(DateTime.Parse(displayedTime).Minute);
yogaSpaceEvent.Time = details.StartTime;
yogaSpaceEvent.Duration = details.Duration;
yogaSpaceEvent.Style = details.Style;
yogaSpaceEvent.DateUpdated = DateTime.Now;
YogaSpaceEvent newEvent = yogaSpaceEvent; // save all the new values in this object to compare with the old object
Tuple<string, string> editedEventEmail = _emailingService.GetEditedEventEmail(oldEvent, newEvent);