public async Task <ActionResult> Post([FromBody] Database.Developer developer) { if (!ModelState.IsValid) { return(BadRequest()); } try { var result = await _service.Post(developer); if (result != null) { return(Created(new Uri(Url.Link("GetWihtId", new { id = result.Id })), result)); } else { return(BadRequest()); } } catch (ArgumentException ex) { return(StatusCode((int)HttpStatusCode.InternalServerError, ex.Message)); } }
public async Task <ActionResult> Put([FromBody] Database.Developer developer) { if (!ModelState.IsValid) { return(BadRequest()); } try { var result = await _service.Put(developer); if (result != null) { return(Ok(result)); } else { return(BadRequest()); } } catch (ArgumentException ex) { return(StatusCode((int)HttpStatusCode.InternalServerError, ex.Message)); } }