Example #1
0
 public ActionResult Edit([Bind(Include = "UserId,UserName,UserPhone,UserPassword")] User user)
 {
     if (Session["USER"] == null || Session["USER"].ToString() != "user")
     {
         return(RedirectToAction("Login", "UserLogin"));
     }
     else
     {
         if (ModelState.IsValid)
         {
             db.Entry(user).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Logout"));
         }
         return(View(user));
     }
 }
Example #2
0
 public ActionResult Edit([Bind(Include = "SalesmanId,SalesmanName,SalesmanEmail,SalesmanPhone,SalesmanAddress,SalesmanDOB,SalesmanJoiningDate,SalesmanSalary,SalesmanPassword")] Salesman salesman)
 {
     if (Session["SALESMAN"] == null || Session["SALESMAN"].ToString() != "salesman")
     {
         return(RedirectToAction("Login", "SalesmenLogin"));
     }
     else
     {
         if (ModelState.IsValid)
         {
             db.Entry(salesman).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Logout"));
         }
         return(View(salesman));
     }
 }
 public ActionResult Edit([Bind(Include = "CategoryId,CategoryName")] Category category)
 {
     if (Session["ADMIN"] == null || Session["ADMIN"].ToString() != "admin")
     {
         return(RedirectToAction("Login", "AdminLogin"));
     }
     else
     {
         if (ModelState.IsValid)
         {
             db.Entry(category).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View(category));
     }
 }
Example #4
0
 public ActionResult Edit([Bind(Include = "AdminId,AdminName,AdminEmail,AdminPhone,AdminAddress,AdminDOB,AdminPassword")] Admin admin)
 {
     if (Session["ADMIN"] == null || Session["ADMIN"].ToString() != "admin")
     {
         return(RedirectToAction("Login", "AdminLogin"));
     }
     else
     {
         if (ModelState.IsValid)
         {
             db.Entry(admin).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Logout"));
         }
         return(View(admin));
     }
 }
Example #5
0
 public ActionResult Edit([Bind(Include = "ProductId,ProductName,ProductPrice,ProductQuantity,CategoryId")] Product product)
 {
     if (Session["ADMIN"] == null || Session["ADMIN"].ToString() != "admin")
     {
         return(RedirectToAction("Login", "AdminLogin"));
     }
     else
     {
         if (ModelState.IsValid)
         {
             db.Entry(product).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         ViewBag.CategoryId = new SelectList(db.Categories, "CategoryId", "CategoryName", product.CategoryId);
         return(View(product));
     }
 }
Example #6
0
 public ActionResult Edit([Bind(Include = "InvoiceId,InvoiceDate,InvoiceTotal,SalesmanId")] Record record)
 {
     if (Session["SALESMAN"] == null || Session["SALESMAN"].ToString() != "salesman")
     {
         return(RedirectToAction("Login", "SalesmenLogin"));
     }
     else
     {
         if (ModelState.IsValid)
         {
             db.Entry(record).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         ViewBag.SalesmanId = new SelectList(db.Salesmans, "SalesmanId", "SalesmanName", record.SalesmanId);
         return(View(record));
     }
 }