public async Task <IHttpActionResult> Edit(int id, RoleForUpdateDTO model) { if (ModelState.IsValid) { var role = await RoleManager.FindByIdAsync(id); role.Name = model.Name; await RoleManager.UpdateAsync(role); return(Ok("rol başarıyla güncellendi")); } return(BadRequest("Eksisk veya hatalı bilgi girdiniz")); }
public async Task <IActionResult> UpdateRole(int id, RoleForUpdateDTO model) { if (!ModelState.IsValid) { return(BadRequest(Messages.ModelNullOrEmpty)); } var role = await _authService.FindRoleByIdAsync(id); if (!role.Success) { return(BadRequest(role.Message)); } role.Data.Name = model.Name; var result = await _authService.UpdateRoleAsync(role.Data); if (result.Success) { return(Ok(result.Message)); } return(BadRequest(result.Message)); }