public async Task <IActionResult> CreateManageability(RiskManageabilityForCreateDto manageabilityForCreateDto) { RiskManageability newManageability = _mapper.Map <RiskManageability>(manageabilityForCreateDto); _context.Add(newManageability); if (await _context.SaveChangesAsync() > 0) { return(Ok(newManageability)); } return(BadRequest("Error create Risk Manageability")); }
public async Task <IActionResult> UpdateManageability(int id, RiskManageability manageabilityForUpdate) { var manageability = await _context.RiskManageabilities .FirstOrDefaultAsync(m => m.Id == id); if (manageability == null) { return(NotFound()); } manageability.Name = manageabilityForUpdate.Name; if (await _context.SaveChangesAsync() > 0) { return(CreatedAtRoute("GetManageability", new { controller = "References", id = manageability.Id }, manageability)); } return(BadRequest("Error update Risk Manageability")); }