public ActionResult SelectCustomers() { MailSelectCustomersViewModel viewModel = new MailSelectCustomersViewModel(); CustomerService cService = new CustomerService(); viewModel.Customers = cService.GetCustomers(); return View(viewModel); }
// // GET: /Customers/ public ActionResult Index() { CustomerIndexViewModel viewModel = new CustomerIndexViewModel(); CustomerService cService = new CustomerService(); viewModel.Customers = cService.GetCustomers(); return View(viewModel); }
public JsonResult FilterCustomers(string company) { try { CustomerService cService = new CustomerService(); List<CustomerDataModel> customers; if (company == "") { customers = cService.GetCustomers(); } else { customers = cService.GetCustomers(company); } return Json(customers, JsonRequestBehavior.AllowGet); } catch (Exception) { return Json(false, JsonRequestBehavior.DenyGet); } }
public ActionResult WriteLetter(FormCollection collection) { // select id of every checked customer int[] checkedCustomersId = collection.GetValues("id_customer").Select(n => Convert.ToInt32(n)).ToArray(); CustomerService cService = new CustomerService(); MailWriteLetterViewModel viewModel = new MailWriteLetterViewModel(); viewModel.CustomersToSend = cService.GetCustomers(c => checkedCustomersId.Contains(c.Id)); TempData["CustomersToSend"] = viewModel.CustomersToSend; return View(viewModel); }