Пример #1
0
        public List <MoviesVM> GetMovieByGenre(Genre genre)
        {
            var filteredMovies = _movieRepo.GetAll().Where(x => x.MovieGenre == genre).ToList();
            var vms            = Mappers.MapMoviesToMoviesVM(filteredMovies);

            return(vms);
        }
Пример #2
0
        public bool CreateOrder(OrderVM order)
        {
            var orders = _orderReop.GetAll().ToList();

            Order newOrder = new Order()
            {
                Movie = new List <Movie>(),
                User  = new User()
            };

            if (!orders.Equals(order))
            {
                return(false);
            }
            _orderReop.Create(newOrder);
            Mappers.FromOrderToOrderVM(newOrder);
            return(true);
        }
Пример #3
0
        public bool CreateUser(UserVM user)
        {
            var  users   = _userReop.GetAll().ToList();
            User newUser = new User()
            {
                Name        = user.Name,
                LastName    = user.LastName,
                Email       = user.Email,
                UserName    = user.UserName,
                Password    = user.Password,
                PhoneNumber = user.PhoneNumber,
                Order       = new List <Order>()
            };

            if (!users.Equals(user))
            {
                return(false);
            }
            _userReop.Create(newUser);
            Mappers.MapUserToUserVM(newUser);
            return(true);
        }