Ejemplo n.º 1
0
 public ActionResult ChangePassword(VendorEditPasswordViewModel vepvm)
 {
     if (ModelState.IsValid)
     {
         try
         {
             Vendor vendor = (from c in entity.Vendors where c.VendorId == vepvm.VendorId select c).FirstOrDefault();
             if (vendor.VendorPassword == vepvm.VendorPassword)
             {
                 return(RedirectToAction("UserPanel", "Home"));
             }
             else
             {
                 vendor.VendorPassword = vepvm.VendorPassword;
                 if (entity.SaveChanges() > 0)
                 {
                     return(RedirectToAction("UserPanel", "Home"));
                 }
                 else
                 {
                     ViewData["message"] = "There's a problem going on. please try again later.";
                     return(View(vepvm));
                 }
             }
         }
         catch (Exception ex)
         {
             return(View("Error", new HandleErrorInfo(ex, "Vendor", "ChangePassword")));
         }
     }
     else
     {
         return(View(vepvm));
     }
 }
Ejemplo n.º 2
0
 public ActionResult ChangePassword()
 {
     if ((string)Session["userCode"] == "vendor")
     {
         int VendorId = (int)Session["VendorId"];
         VendorEditPasswordViewModel vepvm = new VendorEditPasswordViewModel();
         vepvm.VendorId = VendorId;
         return(View(vepvm));
     }
     else
     {
         Session["user"] = "******";
         return(RedirectToAction("Index", "Home"));
     }
 }