public void Execute(CreatFilmDto request) { _context.Film.Add(new Film { Naziv = request.Naziv, Opis = request.Opis, DatumPrikaza = request.DatumPrikaza, Trajanje = request.Trajanje }); _context.SaveChanges(); }
public IActionResult Post([FromBody] CreatFilmDto dto) { try { _creatFilm.Execute(dto); return(StatusCode(201)); } catch (EntityNotFoundException e) { return(UnprocessableEntity(e.Message)); } catch (Exception) { return(StatusCode(500)); } }