示例#1
0
        public IActionResult Create(long id)
        {
            //Product product = _unityOfWork.Product.GetById(quickAdventure.ProductID);
            //ApplicationUser user = _db.Users.FirstOrDefault(x => x.Id == quickAdventure.UserID);
            QuickAdventureViewModel model = new QuickAdventureViewModel()
            {
                Product = _unityOfWork.Product.GetById(id)
            };


            return(View(model));
        }
示例#2
0
        public IActionResult Create(QuickAdventureViewModel quickAdventure)
        {
            //Product product = _unityOfWork.Product.GetById(quickAdventure.ProductID);
            //ApplicationUser user = _db.Users.FirstOrDefault(x => x.Id == quickAdventure.UserID);
            QuickAdventure model = new QuickAdventure()
            {
                UserID    = _db.Users.FirstOrDefault(x => x.Email == quickAdventure.Email).Id,
                ProductID = quickAdventure.ProductID,
                DateTime  = DateTime.Now
            };

            // _db.QuickAdventure.Add(model);
            _db.SaveChanges();
            return(View("CreateSuccessful"));
        }