public static LocalProfileVisit AddLocalVisit(LocalProfileVisit visit) { using (var dbContext = new KaamShaamEntities()) { var obj = new ProfileVisit { DateTime = DateTime.Now, VistedBy = visit.VistedBy, VistedOf = visit.VistedOf }; dbContext.ProfileVisits.Add(obj); dbContext.SaveChanges(); return(obj.Mapper()); } }
public static LocalProfileVisit Mapper(this ProfileVisit source) { var obj = new LocalProfileVisit { Id = source.Id, DateTime = source.DateTime.ToLongDateString() + source.DateTime.ToLongTimeString(), VistedBy = source.VistedBy, // Owner = source.Owner.MapUser(), VistedOf = source.VistedOf, // Vistor = source.Vistor.MapUser() VisitorName = source.Vistor?.FullName }; return(obj); }