public ActionResult _EditModelImage(ModelImageEditVM mModelImageVm)
        {
            var mdl = _svc.GetModel(mModelImageVm.ModelId);

            if (string.IsNullOrEmpty(mModelImageVm.FilePath))
            {
                if (mdl.Image != null)
                {
                    _svc.DeleteImage((int)mdl.ImageId);
                    mdl.ImageId = null;
                }
            }
            else
            {
                if (mdl.Image == null)
                {
                    mdl.Image = new ModelImage();
                }
                UpdateModel(mdl.Image);
                mdl.Image.LoadFile(mModelImageVm.FilePath);
                DocumentController.RemoveFile(mModelImageVm.FilePath);
            }

            if (ExecuteRepositoryAction(() => { _svc.UpdateModel(mdl); _svc.CommitChanges(); }))
            {
                return(ReturnJsonFormSuccess());
            }
            return(PartialView("_EditModelImage", mModelImageVm));
        }
 public CustomerController(CustomerService svc, TransactionsService accountsService, DocumentController documentController, EmployerService employerService)
 {
     _customerService    = svc;
     _documentController = documentController;
     _employerService    = employerService;
     InitialisePaymentSourcesViewBag(accountsService);
     InitialiseEmployersViewBag(employerService);
 }
 public StockModelsController(StockService svc, DocumentController documentController, ContractService contractService)
 {
     _svc = svc;
     _documentController = documentController;
     _contractService    = contractService;
     InitialiseManufacturesViewBag(svc);
     InitialiseCategoriesViewBag(svc);
     InitialiseContractTypeViewBag(contractService, true);
 }
        public ActionResult _EditCustomerDocument(CustomerDocumentVM mCustomerDocument)
        {
            var cd = _customerService.GetCustomerDocument(mCustomerDocument.DocumentId);

            if (TryUpdateModel(cd))
            {
                cd.LoadFile(mCustomerDocument.FilePath);
                DocumentController.RemoveFile(mCustomerDocument.FilePath);
                if (ExecuteRepositoryAction(() => { _customerService.UpdateCustomerDocument(cd); _customerService.CommitChanges(); }))
                {
                    return(ReturnJsonFormSuccess());
                }
            }
            return(PartialView("_EditCustomerDocument", mCustomerDocument));
        }