Exemplo n.º 1
0
        public IHttpActionResult New(AddDvdRequest model)
        {
            dvd movie = new dvd();


            // if (ModelState.IsValid)
            // {


            movie.title        = model.title;
            movie.rating       = model.rating;
            movie.director     = model.director;
            movie.realeaseYear = model.realeaseYear;
            movie.notes        = model.notes;
            _dvdRepository.Add(movie);



            // DvdRepoMock.Edit(movie);

            return(Ok(movie));
            // }
            // else { return NotFound(); }

            // return Ok(DvdRepoMock.GetAll());
        }
Exemplo n.º 2
0
        public void CreateDvd(AddDvdRequest request)
        {
            IDvdRepository repo = DvdRepositoryFactory.Create();

            Dvd dvd = new Dvd
            {
                Title        = request.Title,
                RealeaseYear = request.RealeaseYear,
                Director     = request.Director,
                Rating       = request.Rating,
                Notes        = request.Notes
            };

            repo.AddDvd(dvd);
        }
Exemplo n.º 3
0
        public IHttpActionResult Add(AddDvdRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Dvd dvd = new Dvd()
            {
                Title       = request.Title,
                ReleaseYear = request.ReleaseYear,
                Director    = request.Director,
                Rating      = request.Rating,
                Notes       = request.Notes
            };

            _dvdRepo.Add(dvd);
            return(Created($"dvds/get/{dvd.DvdID}", dvd));
        }
Exemplo n.º 4
0
        public IHttpActionResult Add(AddDvdRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            DVDdb dvd = new DVDdb()
            {
                title        = request.title,
                realeaseYear = request.realeaseYear,
                director     = request.director,
                rating       = request.rating,
                notes        = request.notes //Not Required
            };

            DvdRepositoryFactory.GetRepository().Add(dvd);
            return(Created($"dvds/get/{dvd.dvdId}", dvd));
        }
Exemplo n.º 5
0
        public IHttpActionResult Add(AddDvdRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Dvd dvd = new Dvd()
            {
                title        = request.title,
                realeaseYear = request.realeaseYear,
                rating       = request.rating,
                director     = request.director,
                notes        = request.notes
            };

            repo.Add(dvd);
            return(Created($"dvds/get/{dvd.dvdId}", dvd));
        }
Exemplo n.º 6
0
        public IHttpActionResult Add(AddDvdRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            DvdDetails dvd = new DvdDetails()
            {
                Title        = request.title,
                Year         = request.realeaseYear,
                DirectorName = request.director,
                RatingValue  = request.rating.ToUpper(),
                Note         = request.notes
            };

            DvdRepoFactory.GetRepository().Insert(dvd);
            return(Created($"dvd/{dvd.DvdID}", dvd));
        }
Exemplo n.º 7
0
        public IHttpActionResult AddDvd(AddDvdRequest request)
        {
            IDVDLibraryRepo myRepo = DVDRepoFactory.GetRepository();

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            DVD dvd = new DVD()
            {
                Title       = request.Title,
                ReleaseYear = request.ReleaseYear,
                Director    = request.Director,
                Rating      = request.Rating,
                Notes       = request.Notes,
            };

            myRepo.AddDvd(dvd);
            return(Created($"dvd/get/{dvd.DVDId}", dvd));
        }