Ejemplo n.º 1
0
        public ActionResult Create(Customer customer)
        {
            var loginUser = _usr.GetLoginUser(User.Identity.Name); // db.Users.Where(i => i.UserName == User.Identity.Name).FirstOrDefault();
            if (loginUser != null)
            {
                customer.CustomerID = loginUser.CustomerID;
            }

            if (ModelState.IsValid)
            {
                _cus.Add(customer);
                //db.Customers.Add(customer);
                //db.SaveChanges();
                return RedirectToAction("Index","Product");
            }

            return View(customer);
        }
Ejemplo n.º 2
0
 public ActionResult Edit(Customer customer)
 {
     if (ModelState.IsValid)
     {
         _cus.Edit(customer);
         //db.Entry(customer).State = EntityState.Modified;
         //db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(customer);
 }