Ejemplo n.º 1
0
        public async Task <ActionResult> Create(Treat treat)
        {
            var userId      = this.User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
            var currentUser = await _userManager.FindByIdAsync(userId);

            treat.User = currentUser;
            _db.Treats.Add(treat);
            _db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> Create(Flavor Flavor, int TreatId)
        {
            var userId      = this.User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
            var currentUser = await _userManager.FindByIdAsync(userId);

            Flavor.User = currentUser;
            _db.Flavors.Add(Flavor);
            if (TreatId != 0)
            {
                _db.TreatsFlavor.Add(new TreatsFlavor()
                {
                    TreatId = TreatId, FlavorId = Flavor.FlavorId
                });
            }
            _db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
 public ActionResult Create(Flavor flavor)
 {
     _db.Flavors.Add(flavor);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Ejemplo n.º 4
0
 public ActionResult Create(Food food)
 {
     _db.Foods.Add(food);
     _db.SaveChanges();
     return(RedirectToAction("Details", new { id = food.FoodId }));
 }
 public ActionResult Create(Treat treat)
 {
     _db.Treats.Add(treat);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Ejemplo n.º 6
0
 public ActionResult Create(Flavor flavor)
 {
     _db.Flavors.Add(flavor);
     _db.SaveChanges();
     return(RedirectToAction("Details", new { id = flavor.FlavorId }));
 }
Ejemplo n.º 7
0
 public ActionResult Create(Snack Snack)
 {
     _db.Snacks.Add(Snack);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }