public ActionResult changepassword(empPasswordVM chview)
        {
            var user = db.storeemployees.SingleOrDefault(x => x.id == chview.username && x.password == chview.password);

            if (user != null)
            {
                user.password = chview.newpassword;

                db.Entry(user).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Success"));
            }
            else
            {
                ModelState.AddModelError("password", "Invalid Username or Password");
                return(View());
            }
        }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "id,categoryname,description")] category category)
 {
     if (ModelState.IsValid)
     {
         db.Entry(category).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(category));
 }
Ejemplo n.º 3
0
        public ActionResult Edit([Bind(Include = "id,categoryid,subcategoryname,description")] subcategory subcategory)
        {
            if (ModelState.IsValid)
            {
                db.Entry(subcategory).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.categories = new SelectList(db.categories, "id", "categoryname", subcategory.category);
            return(View(subcategory));
        }
Ejemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "stockid,productid,storeid,quantity,dateofstock,employeeid")] stock stock)
 {
     if (ModelState.IsValid)
     {
         db.Entry(stock).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.productid  = new SelectList(db.products, "pid", "productname", stock.productid);
     ViewBag.employeeid = new SelectList(db.storeemployees, "id", "name", stock.employeeid);
     ViewBag.storeid    = new SelectList(db.stores, "storeid", "storename", stock.storeid);
     return(View(stock));
 }
        public ActionResult Edit([Bind(Include = "username,password,Confirmpassword,fullname,gender,emailid,usertype")] Administrator administrator)
        {
            if (Session["uid"] == null)
            {
                return(RedirectToAction("AdminLogin"));
            }
            if (Session["utype"].ToString() == "Limited")
            {
                return(RedirectToAction("notauthorised", "Administrators"));
            }

            if (ModelState.IsValid)
            {
                db.Entry(administrator).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            else
            {
                var errors = ModelState.Where(x => x.Value.Errors.Count > 0).Select(x => new { x.Key, x.Value.Errors }).ToArray();
            }
            return(View(administrator));
        }
 public ActionResult Edit([Bind(Include = "memberid,merchantname,emailid,mobileno,address,identifyproof,vatno,servicetaxno,dateofexpiry,status,storeid")] membership membership, HttpPostedFileBase identifyproof)
 {
     if (ModelState.IsValid)
     {
         if (identifyproof != null)
         {
             string photoname = identifyproof.FileName;
             identifyproof.SaveAs(Server.MapPath("~/uploads/" + photoname));
             membership.identifyproof = "~/uploads/" + photoname;
         }
         db.Entry(membership).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.storeid = new SelectList(db.stores, "storeid", "storename", membership.storeid);
     return(View(membership));
 }
 public ActionResult Edit([Bind(Include = "cardnumber,cardholdernname,photo,Mobileno,address,memberid")] membership_cards membership_cards, HttpPostedFileBase photo)
 {
     if (ModelState.IsValid)
     {
         if (photo != null)
         {
             string photoname = photo.FileName;
             photo.SaveAs(Server.MapPath("~/uploads/" + photoname));
             membership_cards.photo = "~/uploads/" + photoname;
         }
         db.Entry(membership_cards).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.memberid = new SelectList(db.memberships, "memberid", "merchantname", membership_cards.memberid);
     return(View(membership_cards));
 }
 public ActionResult Edit([Bind(Include = "pid,productname,description,subcatid,price,discount,photo,storeid,skunumber")] product product, HttpPostedFileBase EPhoto)
 {
     product.storeid = Convert.ToInt32(Session["Storeid"]);
     if (ModelState.IsValid)
     {
         if (EPhoto != null)
         {
             string photoname = EPhoto.FileName;
             EPhoto.SaveAs(Server.MapPath("~/uploads/" + photoname));
             product.photo = "~/uploads/" + photoname;
         }
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.storeid  = new SelectList(db.stores, "storeid", "storename", product.storeid);
     ViewBag.subcatid = new SelectList(db.subcategories, "id", "subcategoryname", product.subcatid);
     return(View(product));
 }