Ejemplo n.º 1
0
 public IActionResult Post([FromBody] MediaModel mediaModel)
 {
     try
     {
         return(Ok(_mediaService.Add(mediaModel.ToDomainModel())));
         //return NotFound();
     }
     catch (Exception e)
     {
         ModelState.AddModelError("Post", e.Message);
         return(BadRequest(ModelState));
     }
 }
Ejemplo n.º 2
0
        public IActionResult Put(int id, [FromBody] MediaModel mediaModel)
        {
            var current = _mediaService.Get(id);

            if (current == null)
            {
                return(NotFound());
            }

            current = _mediaService.Update(mediaModel.ToDomainModel());
            //return NotFound();

            return(Ok(current));
        }