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