public async Task <ActionResult> CreateLocation(CreateLocationViewModel model) { var locationRepository = new LocationRepo(); var orderRepository = new OrderRepo(); var customerRepository = new CustomerRepo(); var userId = User.Identity.GetUserId(); var location = new Models.Location { Title = model.Title, SecondTitle = model.SecondTitle, Customer = model.Customer, }; var order = new Order { LocationId = location.LocationId, UserId = userId }; location.UsersId.Add(userId); var testCustIds = await customerRepository.GetAllAsync(); await locationRepository.AddAsync(location); await orderRepository.AddAsync(order); return(RedirectToAction("Index", "Home", new { area = "" })); }