Exemplo 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"));
        }
Exemplo n.º 2
0
 public ActionResult Create(Flavor flavor)
 {
     _db.Flavors.Add(flavor);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }