public async Task <ActionResult> Create(Order newObject)
        {
            var userId      = this.User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
            var currentUser = await _userManager.FindByIdAsync(userId);

            newObject.User = currentUser;
            _db.Orders.Add(newObject);
            _db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Create(Flavor newObject)
 {
     _db.Flavors.Add(newObject);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Пример #3
0
 public ActionResult Create(Treat treat)
 {
     _db.Treats.Add(treat);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }