Пример #1
0
        /// <summary>
        ///     Update row of grid.
        /// </summary>
        public ActionResult UpdateGridForVendors([ModelBinder(typeof(DevExpressEditorsBinder))] VendorsModel model)
        {
            try
            {
                if (VendorRepository.IsUniqueVendor(model, Action.Update))
                {
                    VendorRepository.UpdateVendor(model);
                }
                else
                {
                    TempData["ErrorMessage"] = Supervisor.VErrorMsgVendorExist;
                }
            }
            catch (Exception exc)
            {
                TempData["ErrorMessage"] = exc.Message;

                Logger.LogError(exc, "Error while updating vendors from Supervisor zone");
            }

            return(PartialView("Grid/_GridForVendors", VendorRepository.Vendors));
        }
Пример #2
0
        public ActionResult VendorPost(VendorsModel model)
        {
            try
            {
                if (VendorRepository.IsUniqueVendor(model, Action.New))
                {
                    VendorRepository.SaveNewVendor(model);

                    TempData["ConfirmMessage"] = string.Format(Common.ConfirmDiv,
                                                               string.Format(Supervisor.VMsgVendorCreated, model.Name));
                }
                else
                {
                    TempData["ErrorMessage"] = string.Format(Common.ErrorDiv, Supervisor.VErrorMsgVendorExist);
                }
            }
            catch (Exception exc)
            {
                TempData["ErrorMessage"] = string.Format(Common.ErrorDiv, exc.Message);
                Logger.LogError(exc, "Error while saving new vendor from Supervisor zone");
            }

            return(PartialView("_Result"));
        }