public IActionResult Update(string id, Match min) { var match = _matchService.Get(id); if (match == null) { return(NotFound()); } _matchService.Update(id, min); return(NoContent()); }
public ActionResult <object> Put(int id, [FromBody] MatchesViewModel user) { if (user == null || user.Id != id) { var toSerialize = new MessageHelpers <MatchesViewModel>() { Status = 404, Data = null }; return(JsonConvert.SerializeObject(toSerialize)); } else { try { int retVal = _matchesService.Update(user); if (retVal == 0 && retVal > 0) { var toSerialize = new MessageHelpers <MatchesViewModel>() { Status = 200, Data = null }; return(JsonConvert.SerializeObject(toSerialize)); } else { var toSerialize = new MessageHelpers <MatchesViewModel>() { Status = 404, Data = null }; return(JsonConvert.SerializeObject(toSerialize)); } } catch { var toSerialize = new MessageHelpers <MatchesViewModel>() { Status = 502, Data = null }; return(JsonConvert.SerializeObject(toSerialize)); } } }