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)); }
public ActionResult ClerkAdd(AddClerkModel WebData) { try { String MerchantID = GetFromMerchantIDCookie(); if (ModelState.IsValid) { ICLerkService ClerkServiceInstance = new ClerkService(); if (ClerkServiceInstance.AddClerk(MerchantID, WebData)) { return(RedirectToAction("ClerkManagement")); } } } catch (Exception Ex) { ModelState.AddModelError("", Common.StandardExceptionHandler(Ex, "Add Clerk", Request.Form)); Log.BadData(Request.UserHostAddress, Request.Url.ToString(), Request.Form); } // If we got this far, something failed, redisplay form return(View(WebData)); }