public async Task <IActionResult> Update(int id, [FromBody] string pointDescription) { var point = new Point { Id = id, Description = pointDescription }; await _pointService.UpdateAsync(point); return(NoContent()); }
public async Task <IActionResult> PutAsync(int id, [FromBody] Point resource) { if (!ModelState.IsValid) { return(BadRequest(ModelState.GetErrorMessages())); //test valid or not } //map data from SaveResource & save back //var point=_mapper.Map<SavePointResource , Point>(resource); var result = await _pointService.UpdateAsync(id, resource); if (result == null) { return(BadRequest(result)); } var productResource = _mapper.Map <Point, PointResource>(result.Point); return(Ok(productResource)); }