public void Edit(int ProductId, string ProductName, int CategoryId, int Instock, int BrandId, int ProductPrice, string ProductDescription, int ProductDiscount)
        {
            Product p = db.Products.SingleOrDefault(x => x.ProductId == ProductId);

            p.ProductName        = ProductName;
            p.CategoryId         = CategoryId;
            p.Instock            = Instock;
            p.BrandId            = BrandId;
            p.ProductPrice       = p.ProductPrice;
            p.ProductDescription = ProductDescription;
            p.ProductDiscount    = ProductDiscount;
            db.Entry(p).State    = EntityState.Modified;
            db.SaveChanges();
        }
 public ActionResult Edit([Bind(Include = "BrandId,BrandName,BrandImage")] Brand brand)
 {
     if (ModelState.IsValid)
     {
         db.Entry(brand).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(brand));
 }
示例#3
0
 public ActionResult Edit([Bind(Include = "CategoryId,CategoryStatus,CategoryParentId,CategoryName")] Category category)
 {
     if (ModelState.IsValid)
     {
         db.Entry(category).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(category));
 }
 public ActionResult Edit(Size s)
 {
     if (ModelState.IsValid)
     {
         db.Entry(s).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(s));
 }
 public ActionResult Edit([Bind(Include = "UserId,UserName,Password,Email,UserStatus")] User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(user));
 }
示例#6
0
 public ActionResult Edit([Bind(Include = "AdminId,AdminPassword,AdminUsername,AdminIsDeleted,AdminIsDisabled,IsSuper")] ShoesProjectModels.Model.Admin admin)
 {
     if (ModelState.IsValid)
     {
         db.Entry(admin).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(admin));
 }
示例#7
0
 public ActionResult Edit([Bind(Include = "BusinessId,BusinessName")] Business business)
 {
     if (ModelState.IsValid)
     {
         db.Entry(business).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(business));
 }
 public ActionResult Edit([Bind(Include = "ColorId,ColorValue,ColorCode,ColorStatus")] Color color)
 {
     if (ModelState.IsValid)
     {
         db.Entry(color).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(color));
 }
示例#9
0
 public ActionResult Edit([Bind(Include = "VoucherId,VoucherName,Code,DiscountPercent,Remain,ExpiredAt")] Voucher voucher)
 {
     if (ModelState.IsValid)
     {
         voucher.Code            = voucher.Code.ToUpper().ToString();
         db.Entry(voucher).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(voucher));
 }
示例#10
0
 public ActionResult Edit([Bind(Include = "PermissonId,PermissonName,PermissonDescription,BusinessId")] Permisson permisson)
 {
     if (ModelState.IsValid)
     {
         db.Entry(permisson).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.BusinessId = new SelectList(db.Businesses, "BusinessId", "BusinessName", permisson.BusinessId);
     return(View(permisson));
 }
示例#11
0
 public ActionResult Edit([Bind(Include = "OrderId,UserId,VoucherId,Address,PhoneNumber,ProgressStatus,OrderStatus")] Order order)
 {
     if (ModelState.IsValid)
     {
         db.Entry(order).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.UserId    = new SelectList(db.Users, "UserId", "UserName", order.UserId);
     ViewBag.VoucherId = new SelectList(db.Vouchers, "VoucherId", "VoucherName", order.VoucherId);
     return(View(order));
 }
        public ActionResult ForgotPassword(string Email)
        {
            var user = db.Users.SingleOrDefault(x => x.Email.Equals(Email));

            if (user != null)
            {
                user.Password        = Utility.getHashedMD5("1234");
                db.Entry(user).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                string content = System.IO.File.ReadAllText(Server.MapPath("~/Template/content.html"));
                content = content.Replace("{{CustomerName}}", user.UserName);
                content = content.Replace("{{Email}}", user.Email);

                new MailHelper().SendMail(user.Email, "Password Reset", content);
                return(RedirectToAction("Index", "Login"));
            }
            else
            {
                return(RedirectToAction("ForgotPassword"));
            }
        }
示例#13
0
 public ActionResult Edit([Bind(Include = "OrderId,ProductId,ColorId,SizeId,Quantity,OldPrice")] OrdersDetail ordersDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ordersDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ColorId   = new SelectList(db.Colors, "ColorId", "ColorValue", ordersDetail.ColorId);
     ViewBag.OrderId   = new SelectList(db.Orders, "OrderId", "Address", ordersDetail.OrderId);
     ViewBag.ProductId = new SelectList(db.Products, "ProductId", "ProductName", ordersDetail.ProductId);
     ViewBag.SizeId    = new SelectList(db.Sizes, "SizeId", "SizeValue", ordersDetail.SizeId);
     return(View(ordersDetail));
 }