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