public async Task <IActionResult> PutSystemSettingGroup([FromRoute] int id, [FromBody] SystemSettingGroup systemSettingGroup) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != systemSettingGroup.ID) { return(BadRequest()); } _context.Entry(systemSettingGroup).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SystemSettingGroupExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public Task Delete(SystemSettingGroup systemSettingGroup, CancellationToken cancellationToken) { if (_context.SystemSettingGroups.Contains(systemSettingGroup)) { _context.SystemSettingGroups.Remove(systemSettingGroup); _context.SaveChanges(); } return(Task.CompletedTask); }
public Task <SystemSettingGroup> Update(SystemSettingGroup systemSettingGroup, CancellationToken cancellationToken) { var existingSystemSettingGroup = _context.SystemSettingGroups.FirstOrDefault(x => x.Id == systemSettingGroup.Id); existingSystemSettingGroup.Name = systemSettingGroup.Name; existingSystemSettingGroup.Description = systemSettingGroup.Description; existingSystemSettingGroup.Order = systemSettingGroup.Order; existingSystemSettingGroup.ModifiedBy = systemSettingGroup.ModifiedBy; existingSystemSettingGroup.ModifiedAt = systemSettingGroup.ModifiedAt; _context.SaveChanges(); return(Task.FromResult(existingSystemSettingGroup)); }
public async Task <IActionResult> PostSystemSettingGroup([FromBody] SystemSettingGroup systemSettingGroup) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.SystemSettingGroup.Add(systemSettingGroup); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSystemSettingGroup", new { id = systemSettingGroup.ID }, systemSettingGroup)); }
public Task <SystemSettingGroup> Add(SystemSettingGroup systemSettingGroup, CancellationToken cancellationToken) { _context.SystemSettingGroups.Add(systemSettingGroup); _context.SaveChanges(); return(Task.FromResult(systemSettingGroup)); }