예제 #1
0
        public bool CreateFilms(FilmsDto film)
        {
            var existedFilm =
                GetAllFilm().FirstOrDefault(f => AreStringEqual(f.Title, film.Title));

            if (existedFilm != null)
            {
                return(false);
            }
            var entity = new Films
            {
                Title = film.Title,
                AgePG = film.AgePG,
                DirectorProduction = film.DirectorProduction,
                Duration           = film.Duration,
                TraillerUrl        = film.TraillerUrl,
                Affiche            = film.Affiche,
                Rating             = film.Rating,
                About          = film.About,
                HasInScreening = film.HasInScreening,
                Actor          = Mapper.Map <ICollection <Actor> >(film.Actor),
                Premiere       = Mapper.Map <ICollection <Premiere> >(film.Premiere),
                Genre          = Mapper.Map <ICollection <Genre> >(film.Genre),
                Country        = Mapper.Map <ICollection <Country> >(film.Country),
            };

            Insert(entity);
            Work.Db.SaveChanges();
            return(true);
        }
예제 #2
0
        public HttpResponseMessage Post(FilmsDto film)
        {
            var canCreate = _filmServices.CreateFilms(film);

            return((canCreate)
                ? Request.CreateResponse(HttpStatusCode.Created, film)
                : Request.CreateErrorResponse(HttpStatusCode.Conflict, "Film already exist"));
        }
예제 #3
0
        public IHttpActionResult Delete(FilmsDto film)
        {
            var canDelete = _filmServices.DeleteFilm(film);

            if (!canDelete)
            {
                return(NotFound());
            }
            else
            {
                return(Ok(film));
            }
        }
예제 #4
0
        public IHttpActionResult Put(FilmsDto film)
        {
            var canUpdate = _filmServices.UpdateFilm(film);

            if (!canUpdate)
            {
                return(NotFound());
            }
            else
            {
                return(Ok(film));
            }
        }
예제 #5
0
        public CreateFilmVIewModel(IFilmsRequest filmDataHttpProxy, IActorRequest actorDataHttpProxy, ICountryRequest countryDataHttpProxy, IGenreRequest genreDataProxy)
        {
            #region Proxy Initialize


            _actorDataHttpProxy   = actorDataHttpProxy;
            _countryDataHttpProxy = countryDataHttpProxy;
            _genreDataProxy       = genreDataProxy;
            _filmDataHttpProxy    = filmDataHttpProxy;

            #endregion

            #region Initilize List
            ListInitialisation();
            #endregion

            #region GetDataFromServeur



            #endregion

            #region ObservableCollectionInitalize

            AddCountryUserControlCollection   = new ObservableCollection <CountryDto>();
            AddActorUserControlCollection     = new ObservableCollection <ActorDto>();
            AddPremiereUserControlsCollection = new ObservableCollection <PremiereDto>();
            AddGenresUserControlsCollection   = new ObservableCollection <GenreDto>();
            #endregion

            #region Commande Intialize

            AddCountryUserControlCommand  = new RelayCommand(CreateCountryUserControls);
            AddActorUserControlCommand    = new RelayCommand(CreateActorUserControls);
            AddPremiereUserControlCommand = new RelayCommand(CreatePremierUserControls);
            AddGenreUserControlCommand    = new RelayCommand(CreateGenreUserContrlos);
            BrowseImageCommand            = new RelayCommand(OpenFileDialog);
            SubmitFilm = new RelayCommand <IClosable>(PullServeur);

            #endregion

            #region Initialize Film
            Films = new FilmsDto()
            {
                Actor    = new Collection <ActorDto>(),
                Country  = new Collection <CountryDto>(),
                Genre    = new Collection <GenreDto>(),
                Premiere = new Collection <PremiereDto>()
            };
            #endregion
        }
예제 #6
0
        public bool DeleteFilm(FilmsDto film)
        {
            var hasExist = Exists <Films>(film.ID_film);

            if (!hasExist)
            {
                return(false);
            }
            else
            {
                Delete(Mapper.Map <Films>(film));
                Work.Db.SaveChanges();
                return(true);
            }
        }
예제 #7
0
 public async Task FIlmpost()
 {
     //var connectionService = new ConectionService {Uri = "api/film"};
     var filmsTest = new FilmsDto()
     {
         HasInScreening = false,
         Title          = "filmtest7",
         About          = "",
         Actor          = new List <ActorDto>()
         {
             new ActorDto()
             {
                 Name = "actor"
             }
         },
         Affiche = new byte[0],
         AgePG   = 1,
         Country = new List <CountryDto>()
         {
             new CountryDto()
             {
                 Country1 = "country"
             }
         },
         DirectorProduction = "director",
         Duration           = TimeSpan.Parse("2:00:00"),
         Premiere           =
             new List <PremiereDto>()
         {
             new PremiereDto()
             {
                 PremiereDate = DateTime.Parse("17.02.2017"), CountryPremieres = "here"
             }
         },
         Genre = new List <GenreDto> {
             new GenreDto()
             {
                 GenreName = "affaf"
             }
         },
         Seance = new List <SeanceDto>()
     };
     //var result = await connectionService.Create(filmsTest);
     //Assert.IsTrue(result!=null);
 }
예제 #8
0
 public CreateSeanceViewModel(FilmsDto selectedFilms, ISeancesDataHttpProxy seancesDataHttpProxy)
 {
     _seancesDataHttpProxy = seancesDataHttpProxy;
 }