public AccountGroupResponseDto EditAccountGroup(AccountGroupDto accountGroup, int id) { var accountGroupFromDb = db.AccountGroups.FirstOrDefault(x => !x.DelFlag && x.Id == id); accountGroupFromDb.Name = accountGroup.Name; accountGroupFromDb.Description = accountGroup.Description; db.SaveChanges(); return(new AccountGroupResponseDto(accountGroupFromDb)); }
public AccountGroupResponseDto AddAccountGroup(AccountGroupDto accountGroup) { var accountGroupdb = new Database.Schema.Entity.AccountGroup { Name = accountGroup.Name, Description = accountGroup.Description }; db.AccountGroups.Add(accountGroupdb); db.SaveChanges(); return(new AccountGroupResponseDto(accountGroupdb)); }
public IHttpActionResult EditAccountGroup(int id, [FromBody] AccountGroupDto accountGroup) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } return(Ok(_accountGroupManagementService.EditAccountGroup(accountGroup, id))); } catch (System.Exception e) { return(InternalServerError(e)); } }