public ActionResult <Award> Update([FromBody] Award award, int id) { try { award.Id = id; return(Ok(_service.Update(award))); } catch (System.Exception error) { return(BadRequest(error.Message)); } }
public ActionResult <object> Put(int id, [FromBody] AwardsViewModel user) { if (user == null || user.Id != id) { var toSerialize = new MessageHelpers <AwardsViewModel>() { Status = 404, Data = null }; return(JsonConvert.SerializeObject(toSerialize)); } else { try { int retVal = _awardsService.Update(user); if (retVal == 0 && retVal > 0) { var toSerialize = new MessageHelpers <AwardsViewModel>() { Status = 200, Data = null }; return(JsonConvert.SerializeObject(toSerialize)); } else { var toSerialize = new MessageHelpers <AwardsViewModel>() { Status = 404, Data = null }; return(JsonConvert.SerializeObject(toSerialize)); } } catch { var toSerialize = new MessageHelpers <AwardsViewModel>() { Status = 502, Data = null }; return(JsonConvert.SerializeObject(toSerialize)); } } }