示例#1
0
        public ActionResult ClerkEdit(EditClerkModel WebData)
        {
            try
            {
                String MerchantID = GetFromMerchantIDCookie();
                if (ModelState.IsValid)
                {
                    ICLerkService ClerkServiceInstance = new ClerkService();

                    // I tried to put this into an update method,
                    // but the compiler couldn't find the methods

                    ClerkServiceInstance.DeleteClerk(Convert.ToInt32(WebData.DatabaseID));

                    AddClerkModel ToAdd = new AddClerkModel();
                    ToAdd.ClerkID       = WebData.ClerkID;
                    ToAdd.ClerkName     = WebData.ClerkName;
                    ToAdd.ClerkPassword = WebData.Password;
                    ClerkServiceInstance.AddClerk(MerchantID, ToAdd);
                    ViewData["Message"] = "Update Successful";
                }
            }
            catch (Exception Ex)
            {
                ModelState.AddModelError("", Common.StandardExceptionHandler(Ex, "Clerk Edit", Request.Form));
                Log.BadData(Request.UserHostAddress, Request.Url.ToString(), Request.Form);
            }
            return(View(WebData));
        }
示例#2
0
 public ActionResult ClerkDelete(int ID, String whichButton)
 {
     try
     {
         ICLerkService ClerkServiceInstance = new ClerkService();
         if (ClerkServiceInstance.DeleteClerk(ID))
         {
             ViewData["Message"] = "Clerk deleted";
             return(RedirectToAction("ClerkManagement"));
         }
     }
     catch (Exception Ex)
     {
         ModelState.AddModelError("", Common.StandardExceptionHandler(Ex, "Clerk Delete", Request.Form));
         Log.BadData(Request.UserHostAddress, Request.Url.ToString(), Request.Form);
     }
     return(View());
 }