public void DeleteTeam(DbTeam deletedTeam) { var existingTeam = _context.Teams.FirstOrDefault(t => t.TeamId == deletedTeam.TeamId); existingTeam.IsDeleted = true; SetDateAndUserUpdatedInfo(existingTeam); _context.Teams.AddOrUpdate(existingTeam); _context.SaveChanges(); }
public void UpdateTeam(DbTeam updatedTeam) { SetDateAndUserUpdatedInfo(updatedTeam); var existingTeam = _context.Teams.FirstOrDefault(t => t.TeamId == updatedTeam.TeamId); existingTeam.MapFrom(updatedTeam); _context.Teams.AddOrUpdate(existingTeam); _context.SaveChanges(); }
private void SetDateAndUserUpdatedInfo(DbTeam team) { team.LastModified = DateTime.UtcNow; team.LastModifiedBy = "System Admin"; }
private void SetDateAndUserCreatedInfo(DbTeam team) { team.Created = DateTime.UtcNow; team.CreatedBy = "System Admin"; }
public void CreateTeam(DbTeam team) { SetDateAndUserCreatedInfo(team); _context.Teams.Add(team); _context.SaveChanges(); }