public async Task <IHttpActionResult> Post([FromBody] SignatureRequest data) { try { Signature signature = await _signatureRepository.Create(data.GetObject()); return(new HttpJsonApiResult <SignatureModel>( new SignatureModel(signature), Request, HttpStatusCode.Created)); } catch (Exception) { return(new HttpJsonApiResult <string>( "Internal Server Error", Request, HttpStatusCode.InternalServerError)); } }
public async Task <IHttpActionResult> Update(int id, [FromBody] SignatureRequest data) { try { Signature signature = await _signatureRepository.Update(id, data.GetObject()); if (signature == null) { return(new HttpJsonApiResult <string>("Not Found", Request, HttpStatusCode.NotFound)); } return(new HttpJsonApiResult <SignatureModel>( new SignatureModel(signature), Request, HttpStatusCode.OK)); } catch (Exception) { return(new HttpJsonApiResult <string>( "Internal Server Error", Request, HttpStatusCode.InternalServerError)); } }