Exemplo n.º 1
0
        public IActionResult Edit(EditBankViewModel model)
        {
            validationService.ValidateBankEditing(model, ModelState);

            if (ModelState.IsValid)
            {
                bankService.EditBankInfo(model.Bank.BankInfo, model.BankInfo);
                bankService.EditBank(model.Bank.Id, model.BankInfo);
                return(RedirectToAction("Index", "Bank"));
            }
            else
            {
                return(View(model));
            }
        }
Exemplo n.º 2
0
        public ActionResult Edit(BankEditModel bankEditModel, HttpPostedFileBase UploadImage)
        {
            PopulateDropDownLists(bankEditModel);

            bankEditModel.DisplayIconFlags = DisplayIcon.DisplayExistingIcon | DisplayIcon.DisplayIconPathPreview;

            if (ModelState.IsValid)
            {
                if (UploadImage != null && UploadImage.FileName != bankEditModel.FileName)
                {
                    bankEditModel.DisplayIconFlags = bankEditModel.DisplayIconFlags | DisplayIcon.DisplayUploader;
                    bankEditModel.IconPath         = FileUpload.UploadFileToServer(UploadImage, "IconPath", Config.BankIconBasePath, Config.BankIconMaxSize, Config.BankIconAllowedExtensions);
                }

                bankEditModel.DisplayIconFlags = DisplayIcon.DisplayExistingIcon | DisplayIcon.DisplayIconPathPreview;

                _bankService.EditBank(bankEditModel);

                return(RedirectToAction("Index"));
            }
            return(View(bankEditModel));
        }
Exemplo n.º 3
0
        public IActionResult EditBank(Bank bank)
        {
            if (bank.BankId != bank.BankId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                if (bank.ImageUrl == null)
                {
                    bank.Image = default;
                }
                else
                {
                    _fileService.SavaImage(bank.ImageUrl);
                    bank.Image = bank.ImageUrl.FileName;
                    _bankService.EditBank(bank);
                }
                return(RedirectToAction("Index"));
            }
            return(View(bank));
        }
Exemplo n.º 4
0
 public void Put(int id, [FromBody] BankDetails editedObj)
 {
     _BankService.EditBank(editedObj);
 }
Exemplo n.º 5
0
 public async Task <IActionResult> EditBank([FromBody] Bank bank)
 {
     return(new OkObjectResult(await _bankService.EditBank(bank)));
 }