public async Task <InputUpdateAdmin> Put(AdminDtoPut admin) { var model = _mapper.Map <AdministratorModel>(admin); var entity = _mapper.Map <Administrator>(model); var result = await _repository.UpdateAsync(entity); return(_mapper.Map <InputUpdateAdmin>(result)); }
public async Task <ActionResult> Put([FromBody] AdminDtoPut administrator) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { var result = await _service.Put(administrator); if (result != null) { return(Ok(result)); } else { return(BadRequest()); } } catch (ArgumentException e) { return(StatusCode((int)HttpStatusCode.InternalServerError, e.Message)); } }