public async Task <bool> Create(SLAEscalationUser SLAEscalationUser) { SLAEscalationUserDAO SLAEscalationUserDAO = new SLAEscalationUserDAO(); SLAEscalationUserDAO.Id = SLAEscalationUser.Id; SLAEscalationUserDAO.SLAEscalationId = SLAEscalationUser.SLAEscalationId; SLAEscalationUserDAO.AppUserId = SLAEscalationUser.AppUserId; SLAEscalationUserDAO.CreatedAt = StaticParams.DateTimeNow; SLAEscalationUserDAO.UpdatedAt = StaticParams.DateTimeNow; DataContext.SLAEscalationUser.Add(SLAEscalationUserDAO); await DataContext.SaveChangesAsync(); SLAEscalationUser.Id = SLAEscalationUserDAO.Id; await SaveReference(SLAEscalationUser); return(true); }
public async Task <bool> BulkMerge(List <SLAEscalationUser> SLAEscalationUsers) { List <SLAEscalationUserDAO> SLAEscalationUserDAOs = new List <SLAEscalationUserDAO>(); foreach (SLAEscalationUser SLAEscalationUser in SLAEscalationUsers) { SLAEscalationUserDAO SLAEscalationUserDAO = new SLAEscalationUserDAO(); SLAEscalationUserDAO.Id = SLAEscalationUser.Id; SLAEscalationUserDAO.SLAEscalationId = SLAEscalationUser.SLAEscalationId; SLAEscalationUserDAO.AppUserId = SLAEscalationUser.AppUserId; SLAEscalationUserDAO.CreatedAt = StaticParams.DateTimeNow; SLAEscalationUserDAO.UpdatedAt = StaticParams.DateTimeNow; SLAEscalationUserDAOs.Add(SLAEscalationUserDAO); } await DataContext.BulkMergeAsync(SLAEscalationUserDAOs); return(true); }
public async Task <bool> Update(SLAEscalationUser SLAEscalationUser) { SLAEscalationUserDAO SLAEscalationUserDAO = DataContext.SLAEscalationUser.Where(x => x.Id == SLAEscalationUser.Id).FirstOrDefault(); if (SLAEscalationUserDAO == null) { return(false); } SLAEscalationUserDAO.Id = SLAEscalationUser.Id; SLAEscalationUserDAO.SLAEscalationId = SLAEscalationUser.SLAEscalationId; SLAEscalationUserDAO.AppUserId = SLAEscalationUser.AppUserId; SLAEscalationUserDAO.UpdatedAt = StaticParams.DateTimeNow; await DataContext.SaveChangesAsync(); await SaveReference(SLAEscalationUser); return(true); }