public async Task <IActionResult> GetAll() { var banksViewModel = new BanksViewModel { Banks = await _marketingProvider.Banks.AllAsync() }; return(View(banksViewModel)); }
public HttpResponseMessage GetAllBanks([FromBody] BanksViewModel model) { try { var data = repo.GetAllBanks(); return(Request.CreateResponse(HttpStatusCode.OK, new { success = true, result = data })); } catch (System.Exception ex) { return(Request.CreateResponse(HttpStatusCode.OK, new { success = false, message = ex.Message })); } }
// GET: Banks public async Task <IActionResult> Index(int payeeClassId) { BanksViewModel viewModel = new BanksViewModel { PayeeClassID = payeeClassId, Banks = await _context.Banks .AsNoTracking() .OrderBy(b => b.Name) .ToListAsync() }; return(View(viewModel)); }
public HttpResponseMessage Update([FromBody] BanksViewModel model) { try { var data = repo.UpdateBank(model); if (data != null) { return(Request.CreateResponse(HttpStatusCode.OK, new { success = true, result = model, message = "The record has been creted successfuly" })); } return(Request.CreateResponse(HttpStatusCode.OK, new { success = false, message = "There was error creating record" })); } catch (Exception e) { return(Request.CreateResponse(HttpStatusCode.OK, new { success = false, message = $"There was error creating record{e.Message}" })); } }
public bool UpdateBank(BanksViewModel entity) { var data = (from d in context.tbl_Banks where d.BankId == entity.bankId select d).SingleOrDefault(); if (data != null) { data.BankId = entity.bankId; data.BankName = entity.bankName; data.IsActive = entity.isActive; //data.CreatedBy = entity.createdBy; //data.CreatedOn = entity.createdOn; //data.ModifiedBy = entity.modifiedBy; //data.ModifiedOn = entity.modifiedOn; } ; return(context.SaveChanges() > 0); }
public ActionResult Index() { string _banks = GetPlaidBanks(); List <Institution> banks = Institutions.FromJson(_banks).PurpleInstitutions; List <Bank> Banks = new List <Bank>(); banks.ForEach(b => Banks.Add(new Bank { BankName = b.Name })); //string _logoBank = GetPlaidBank(); //LogoBank logoBank = LogoBank.FromJson(_logoBank); BanksViewModel vm = new BanksViewModel { BankNames = Banks }; return(View(vm)); }
public BanksViewModel AddBank(BanksViewModel entity) { var data = new tbl_Banks { BankId = entity.bankId, BankName = entity.bankName, IsActive = entity.isActive, }; context.tbl_Banks.Add(data); context.SaveChanges(); return(entity); //if (context.SaveChanges() > 0) //{ // return entity; //} //else //{ // return null; //} }