Esempio n. 1
0
 public ActionResult Index()
 {
     var viewModel = new SystemUpdateViewModel();
     return View(viewModel);
 }
Esempio n. 2
0
        public ActionResult Index(SystemUpdateViewModel systemUpdateViewModel)
        {
            try
            {
                var systemUpdate = Mapper.Map<SystemUpdateViewModel, SystemUpdate>(systemUpdateViewModel);

                _systemUpdateService.AddSystemUpdate(systemUpdate);

                TempData["Message"] = ScreenMessages.ValidMessage("System update added.");

            }

            catch (Exception ex)
            {
                TempData["Message"] = ScreenMessages.ErrorMessage("Standard", ex.Message);

                if (Request.IsAjaxRequest())
                {
                    return Json(new { IsError = true, ErrorMesssage = ex.Message }, JsonRequestBehavior.AllowGet);
                }

                return RedirectToAction("Error", "Error");
            }

            // Return updated list
            var viewModel = GetSystemUpdateList();

            return PartialView("_ListSystemUpdate", viewModel);
        }