예제 #1
0
        public void AddNewCustomer(Customer customer1)
        {
            var customer = new DataAccess.Entities.Customers
            {
                FirstName = customer1.FirstName,
                LastName  = customer1.LastName
            };

            _dbContext.Customers.Add(customer);
            _dbContext.SaveChanges();
            customer1.CustomerId = customer.CustomerId;
        }
        public async Task <ActionResult> Create(Movie movie, int DirectorId)
        {
            var userId      = this.User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
            var currentUser = await _userManager.FindByIdAsync(userId);

            _db.Movies.Add(movie);
            if (DirectorId != 0)
            {
                _db.DirectorMovies.Add(new DirectorMovie()
                {
                    DirectorId = DirectorId, MovieId = movie.MovieId
                });
            }
            _db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Create(Director director)
 {
     _db.Directors.Add(director);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }