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)); } }
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)); }
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)); }
public void Put(int id, [FromBody] BankDetails editedObj) { _BankService.EditBank(editedObj); }
public async Task <IActionResult> EditBank([FromBody] Bank bank) { return(new OkObjectResult(await _bankService.EditBank(bank))); }