public async Task <IActionResult> UpdateUserInfo([FromBody] UpdateExampleDTO update) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var response = await _exampleRep.UpdateAsync(update); if (!response) { return(NotFound("Some error ocurred")); } return(Ok()); }
public async Task <bool> UpdateAsync(UpdateExampleDTO update) { #region ConfirmId // confirm if id exist var confirm = await _appDbContext .Example .FindAsync(update.Id); if (confirm == null) { return(false); } #endregion // mapping and convert update (DTO) to confirm (Register) var map = _mapper.Map(update, confirm); await _appDbContext.SaveChangesAsync(); return(true); }