Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
 private void SetDateAndUserUpdatedInfo(DbTeam team)
 {
     team.LastModified = DateTime.UtcNow;
     team.LastModifiedBy = "System Admin";
 }
Ejemplo n.º 4
0
 private void SetDateAndUserCreatedInfo(DbTeam team)
 {
     team.Created = DateTime.UtcNow;
     team.CreatedBy = "System Admin";
 }
Ejemplo n.º 5
0
 public void CreateTeam(DbTeam team)
 {
     SetDateAndUserCreatedInfo(team);
     _context.Teams.Add(team);
     _context.SaveChanges();
 }