Exemplo n.º 1
0
        public ActionResult Create(NutritionProfile nutritionProfile)
        {
            if (ModelState.IsValid)
            {
                //_context.Add(address);


                var userId   = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
                var customer = _context.Customers.Where(c => c.IdentityUserId == userId).First();
                customer.nutritionProfile = nutritionProfile;
                _context.Customers.Update(customer);
                _context.SaveChanges();


                return(RedirectToAction("Index", "Customers"));
            }
            return(View(nutritionProfile));
        }
Exemplo n.º 2
0
        public ActionResult Edit(NutritionProfile nutritionProfile)
        {
            try
            {
                var userId   = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
                var customer = _context.Customers.Where(c => c.IdentityUserId == userId).First();
                customer.nutritionProfile = nutritionProfile;
                _context.Customers.Update(customer);
                _context.SaveChanges();



                return(RedirectToAction("Details"));
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }
Exemplo n.º 3
0
        // GET: NutritionProfile/Create
        public ActionResult Create()
        {
            NutritionProfile nutritionProfile = new NutritionProfile();

            return(View(nutritionProfile));
        }