// POST api/<controller> public IHttpActionResult Post([FromBody] TechVideo value) { var maxId = TechVideosData.TechVideos.Max(vid => vid.Id); value.Id = maxId + 1; TechVideosData.TechVideos.Add(value); return(Ok(value)); }
public IHttpActionResult Patch(int id, [FromBody] TechVideo value) { for (int counter = 0; counter < TechVideosData.TechVideos.Count; counter++) { if (TechVideosData.TechVideos[counter].Id == id) { TechVideosData.TechVideos[counter].Rating = value.Rating; return(Ok()); } } return(NotFound()); }