Exemplo n.º 1
0
        // 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));
        }
Exemplo n.º 2
0
        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());
        }