public ActionResult DeleteCustomer(usp_view_by_customerid_Result objCustomer) { int result = db.usp_delete_customerbyid(Convert.ToInt32(TempData["id"])); this.db.SaveChanges(); if (result == -1) { TempData["notice"] = "Customer is associated with active account"; } else { TempData["notice"] = "Customer is removed successfully"; } return(View()); }
public ActionResult EditCustomer(int?id) { if (Convert.ToInt32(Session["role_id"]) == 1) { usp_view_by_customerid_Result objCustomer = new usp_view_by_customerid_Result(); if (id != null) { objCustomer = db.usp_view_by_customerid(id).FirstOrDefault(); } return(View(objCustomer)); } else { return(RedirectToAction("Login", "Login")); } }
public ActionResult EditCustomer(usp_view_by_customerid_Result objCustomer, FormCollection objForm) { ObjectParameter objParam = new ObjectParameter("Id_out", typeof(int)); objCustomer.State = objForm["dropdownState"]; objCustomer.City = objForm["dropdownCity"]; objCustomer.Status = "Active"; int save = db.usp_save_customer(objCustomer.CustomerId, objCustomer.SSNID, objCustomer.CustomerName, objCustomer.DOB, objCustomer.Address1, objCustomer.Address2, objCustomer.City, objCustomer.State, objCustomer.Status, objParam); this.db.SaveChanges(); int saveVal = Convert.ToInt32(objParam.Value); //return RedirectToAction("CustomerList"); TempData["notice"] = "Customer updated successfully"; ModelState.Clear(); return(View()); }