Esempio n. 1
0
        public ActionResult UpdateExporter(ExporterViewModel exorter)
        {
            var exporterDataService = new ExporterDataService();
            var result = exporterDataService.UpdateExporter(exorter);

            return(Json(result ? new AjaxResult(true) : new AjaxResult(false)));
        }
Esempio n. 2
0
        public ActionResult UpdateExporter(int id)
        {
            var exporterDataService = new ExporterDataService();
            var exporter            = exporterDataService.GetExporter(id);

            return(PartialView(new ExporterViewModel(exporter)));
        }
Esempio n. 3
0
        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();
        }
Esempio n. 4
0
        public ActionResult DeleteExporter(int exporterId)
        {
            var result = new ExporterDataService().DeleteExporter(exporterId);

            return(new JsonResult()
            {
                Data = result,
                ContentType = "application/json",
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Esempio n. 5
0
        public ActionResult GetAllExporters()
        {
            var allExporters = new ExporterDataService().GetAllExporters();

            return(new JsonResult()
            {
                Data = allExporters,
                ContentType = "application/json",
                JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                MaxJsonLength = Int32.MaxValue
            });
        }