public ActionResult GetAllShowRoomCustomers() { dynamic customer = 0; try { if (ModelState.IsValid) { Services.CustomerServiceClient customerServiceClient = new Services.CustomerServiceClient(); customer = customerServiceClient.GetAllShowRoomCustomers(); //if (customer.Count == 0 || customer == null) //{ // ModelState.AddModelError("error", "No Record Found"); //} } } catch (Exception e) { ModelState.AddModelError("error", "Something Wrong"); customer = null; throw e; } return(Json(customer, JsonRequestBehavior.AllowGet)); }
public ActionResult Delete(String ID) { int id = Convert.ToInt32(Helpers.CommonMethods.Decrypt(HttpUtility.UrlDecode(ID))); Customer customer = new Customer(); try { if (ModelState.IsValid) { Services.CustomerServiceClient customerServiceClient = new Services.CustomerServiceClient(); customer = customerServiceClient.GetCustomer(id); ViewBag.Country = new SelectList(db.MCountries, "iCountry", "strCountryName", customer.iCountry); var countryList = db.MCities.Where(x => x.iCountry == customer.iCountry).ToList(); ViewBag.City = new SelectList(countryList, "iCity", "strCityName", customer.iCity); ViewBag.CutomerType = new SelectList(db.MCutomerTypes, "iCutomerTypeID", "strCutomerTypeName", customer.iCutomerTypeID); ViewBag.CreditCategory = new SelectList(db.CreditCategories, "iCreditCategoryID", "strCategory", customer.iCreditCategoryID); } } catch (Exception e) { ModelState.AddModelError("error", "Something Went Wrong"); customer = null; throw e; } //return View("Save", customer); return(View(customer)); }
public ActionResult GenerateIDProof(String ID) { int id = 0; if (ID != "0") { id = Convert.ToInt32(Helpers.CommonMethods.Decrypt(HttpUtility.UrlDecode(ID))); } Customer customer = new Customer(); try { if (ModelState.IsValid) { Services.CustomerServiceClient customerServiceClient = new Services.CustomerServiceClient(); customer = customerServiceClient.GetCustomer(id); } } catch (Exception e) { ModelState.AddModelError("error", "something went wrong"); customer = null; throw e; } //return View(customer); return(Json(customer, JsonRequestBehavior.AllowGet)); }
public ActionResult Save(Customer customers) { bool status = false; //ViewBag.Country = new SelectList(db.MCountries, "iCountry", "strCountryName", customers.iCountry); //ViewBag.City = new SelectList(db.MCities, "iCity", "strCityName", customers.iCity); try { if (ModelState.IsValid) { Services.CustomerServiceClient customerServiceClient = new Services.CustomerServiceClient(); status = customerServiceClient.SaveData(customers); //ViewBag.Country = new SelectList(db.MCountries, "iCountry", "strCountryName", customers.iCountry); //ViewBag.City = new SelectList(db.MCities, "iCity", "strCityName", customers.iCity); return(RedirectToAction("Index")); } } catch (Exception e) { ModelState.AddModelError("error", "Something Went Wrong"); status = false; throw e; } return(View(customers)); // return new JsonResult { Data = new { status = status } }; }
public ActionResult Save(Customer customers) { bool status = false; ViewBag.CutomerType = new SelectList(db.MCutomerTypes, "iCutomerTypeID", "strCutomerTypeName", customers.iCutomerTypeID); ViewBag.Country = new SelectList(db.MCountries, "iCountry", "strCountryName", customers.iCountry); ViewBag.City = new SelectList(db.MCities, "iCity", "strCityName", customers.iCity); ViewBag.CreditCategory = new SelectList(db.CreditCategories, "iCreditCategoryID", "strCategory", customers.iCreditCategoryID); try { if (ModelState.IsValid) { HttpPostedFileBase fileIDCopy = Request.Files["IDCopyImageData"]; HttpPostedFileBase fileVisaCopy = Request.Files["VisaCopyImageData"]; Services.CustomerServiceClient customerServiceClient = new Services.CustomerServiceClient(); status = customerServiceClient.SaveData(customers, fileIDCopy, fileVisaCopy); ViewBag.CutomerType = new SelectList(db.MCutomerTypes, "iCutomerTypeID", "strCutomerTypeName", customers.iCutomerTypeID); ViewBag.Country = new SelectList(db.MCountries, "iCountry", "strCountryName", customers.iCountry); ViewBag.City = new SelectList(db.MCities, "iCity", "strCityName", customers.iCity); return(RedirectToAction("Index", "MCustomer")); } } catch (Exception e) { ModelState.AddModelError("error", "Something Went Wrong"); status = false; throw e; } return(View(customers)); // return new JsonResult { Data = new { status = status } }; }
public ActionResult DeleteCustomers(String ID) { int id = Convert.ToInt32(Helpers.CommonMethods.Decrypt(HttpUtility.UrlDecode(ID))); bool status = false; try { if (ModelState.IsValid) { Services.CustomerServiceClient customerServiceClient = new Services.CustomerServiceClient(); status = customerServiceClient.Delete(id); } } catch (Exception e) { ModelState.AddModelError("error", "Something Went Wrong!"); status = false; throw e; } return(View("Index")); // return new JsonResult { Data = new { status = status } }; }