public ActionResult Delete(string UnitId, string ProcessId, string ActivityId, int?id, int?CustomerId) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } List <NavViewModel> Nav = new List <NavViewModel>(); UnitProcessActObjectViewModel UPA = new UnitProcessActObjectViewModel(); if (!DmlObj.GetUPAwithNav(UnitId, ProcessId, ActivityId, User.GetAmUser(), out Nav, out UPA)) { return(View("Error")); } ViewBag.Nav = Nav; ViewBag.UPA = UPA; AMCustomerAddress AddressObj = DmlObj.GetAddressById(id); if (AddressObj == null) { return(HttpNotFound()); } return(View(AddressObj)); }
public ActionResult DeleteConfirmed(string UnitId, string ProcessId, string ActivityId, int id) { AMCustomerAddress AddressObj = DmlObj.GetAddressById(id); if (DmlObj.DeleteAddress(AddressObj)) { return(RedirectToAction("Index", "Customer", new { UnitId = UnitId, ProcessId = ProcessId, ActivityId = ActivityId })); } else { return(View("Error")); } }
public ActionResult Edit(AMCustomerAddress AddressObj, string UnitId, string ProcessId, string ActivityId) { List <NavViewModel> Nav = new List <NavViewModel>(); UnitProcessActObjectViewModel UPA = new UnitProcessActObjectViewModel(); if (!DmlObj.GetUPAwithNav(UnitId, ProcessId, ActivityId, User.GetAmUser(), out Nav, out UPA)) { return(View("Error")); } ViewBag.Nav = Nav; ViewBag.UPA = UPA; var k = DmlObj.GetCustomerById(AddressObj.CustomerId); if (k == null) { ModelState.AddModelError("PhoneNumber", "مشتری شناسایی نشد"); } if (AddressObj.PhoneType == 0) { ModelState.AddModelError("PhoneType", "نوع شماره تلفن انتخاب نشده است"); } if (AddressObj.PhoneNumber == null || AddressObj.PhoneNumber.Length < 8 || AddressObj.PhoneNumber.Length > 14) { ModelState.AddModelError("PhoneNumber", "شماره تماس نادرست است"); } if (ModelState.IsValid) { if (DmlObj.EditAddress(AddressObj)) { ViewBag.Customer = k; return(View("Success")); } } return(View(AddressObj)); }
public ActionResult Edit(string UnitId, string ProcessId, string ActivityId, int?CustomerId, int?AddressId) { if (AddressId == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } List <NavViewModel> Nav = new List <NavViewModel>(); UnitProcessActObjectViewModel UPA = new UnitProcessActObjectViewModel(); if (!DmlObj.GetUPAwithNav(UnitId, ProcessId, ActivityId, User.GetAmUser(), out Nav, out UPA)) { return(View("Error")); } ViewBag.Nav = Nav; ViewBag.UPA = UPA; var k = DmlObj.GetCustomerById(CustomerId); if (k != null) { ViewBag.Customer = k; } else { ViewBag.Customer = new AMCustomer { Id = 0, FirstName = "مشتری شناسایی نشد" }; } AMCustomerAddress AddressObj = DmlObj.GetAddressById(AddressId); if (AddressObj == null) { return(HttpNotFound()); } return(View(AddressObj)); }