public ActionResult UpdateExporter(ExporterViewModel exorter) { var exporterDataService = new ExporterDataService(); var result = exporterDataService.UpdateExporter(exorter); return(Json(result ? new AjaxResult(true) : new AjaxResult(false))); }
public ActionResult UpdateExporter(int id) { var exporterDataService = new ExporterDataService(); var exporter = exporterDataService.GetExporter(id); return(PartialView(new ExporterViewModel(exporter))); }
private void FillViewBag() { var allCustomers = new CustomerDataService().GetAllCustomers().ToList(); // Create a SelectListItem list from the alarm class configurations which are distinct by their names ViewBag.Customers = allCustomers.GroupBy(x => x.Id) .Select(x => x.FirstOrDefault()).Select( x => new SelectListItem { Text = x.Name, Value = x.Id.ToString() }) .ToList(); ViewBag.SaleStates = EnumHelper.GetSelectList(typeof(SalesState)); ViewBag.Currencies = EnumHelper.GetSelectList(typeof(Currency)); var allExporters = new ExporterDataService().GetAllExporters().ToList(); ViewBag.Exporters = allExporters.GroupBy(x => x.Id) .Select(x => x.FirstOrDefault()).Select( x => new SelectListItem { Text = x.Name, Value = x.Id.ToString() }) .ToList(); }
public ActionResult DeleteExporter(int exporterId) { var result = new ExporterDataService().DeleteExporter(exporterId); return(new JsonResult() { Data = result, ContentType = "application/json", JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public ActionResult GetAllExporters() { var allExporters = new ExporterDataService().GetAllExporters(); return(new JsonResult() { Data = allExporters, ContentType = "application/json", JsonRequestBehavior = JsonRequestBehavior.AllowGet, MaxJsonLength = Int32.MaxValue }); }