public ResponseDTO AddCustomerBank(CustomerBankDTO customerBankDto) { ResponseDTO responseDTO = new ResponseDTO(); CustomerBank customerBank = new CustomerBank(); var exisitingcustomerBank = unitOfWork.CustomerBankRepository.GetByCustomerId(customerBankDto.CustomerId); if (exisitingcustomerBank != null) { throw new PlatformModuleException(string.Format("Customer Bank Account Details Already Exist For Customer Id {0}", customerBankDto.CustomerId)); } customerBank.CustomerBankId = unitOfWork.DashboardRepository.NextNumberGenerator("CustomerBank"); CustomerBankConvertor.ConvertToCustomerBankEntity(ref customerBank, customerBankDto, false); customerBank.CreatedBy = "Admin"; customerBank.CreatedDate = DateTimeHelper.GetISTDateTime(); customerBank.IsDeleted = false; customerBank.ModifiedBy = "Admin"; customerBank.ModifiedDate = DateTimeHelper.GetISTDateTime(); unitOfWork.CustomerBankRepository.Add(customerBank); unitOfWork.SaveChanges(); customerBankDto = CustomerBankConvertor.ConvertTocustomerBankDto(customerBank); responseDTO.Status = true; responseDTO.Message = "Customer Bank Added Successfully"; responseDTO.Data = customerBankDto; return(responseDTO); }
public static void ConvertToCustomerBankEntity(ref CustomerBank customerBank, CustomerBankDTO customerBankDto, bool isUpdate) { customerBank.CustomerId = customerBankDto.CustomerId; if (String.IsNullOrWhiteSpace(customerBankDto.IFSCCode) == false) { customerBank.IFSCCode = customerBankDto.IFSCCode; } if (String.IsNullOrWhiteSpace(customerBankDto.AccountNo) == false) { customerBank.AccountNo = customerBankDto.AccountNo; } if (String.IsNullOrWhiteSpace(customerBankDto.Branch) == false) { customerBank.Branch = customerBankDto.Branch; } if (String.IsNullOrWhiteSpace(customerBankDto.BankName) == false) { customerBank.BankName = customerBankDto.BankName; } if (String.IsNullOrWhiteSpace(customerBankDto.AccountHolderName) == false) { customerBank.AccountHolderName = customerBankDto.AccountHolderName; } if (String.IsNullOrWhiteSpace(customerBankDto.UPIId) == false) { customerBank.UPIId = customerBankDto.UPIId; } }
public void Update(CustomerBank customerBank) { if (customerBank != null) { _repository.Entry <Sql.CustomerBank>(customerBank).State = System.Data.Entity.EntityState.Modified; // _repository.SaveChanges(); } }
public void Add(CustomerBank customerBank) { if (customerBank != null) { _repository.CustomerBanks.Add(customerBank); // _repository.SaveChanges(); } }
public ActionResult DeleteConfirmed(int id) { CustomerBank customerbank = db.CustomerBanks.Find(id); db.CustomerBanks.Remove(customerbank); db.SaveChanges(); return(RedirectToAction("Index")); }
// // GET: /Bank/Delete/5 public ActionResult Delete(int id = 0) { CustomerBank customerbank = db.CustomerBanks.Find(id); if (customerbank == null) { return(HttpNotFound()); } return(View(customerbank)); }
public ActionResult Edit(CustomerBank customerbank) { if (ModelState.IsValid) { db.Entry(customerbank).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CustomerId = new SelectList(db.Customers, "CustomerId", "UserId", customerbank.CustomerId); return(View(customerbank)); }
// // GET: /Bank/Edit/5 public ActionResult Edit(int id = 0) { CustomerBank customerbank = db.CustomerBanks.Find(id); if (customerbank == null) { return(HttpNotFound()); } ViewBag.CustomerId = new SelectList(db.Customers, "CustomerId", "UserId", customerbank.CustomerId); return(View(customerbank)); }
public ActionResult Create(CustomerBank customerbank) { if (ModelState.IsValid) { customerbank.CustomerId = db.Customers.Where(s => s.UserId == UserID).First().CustomerId; db.CustomerBanks.Add(customerbank); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customerbank)); }
public IActionResult PaymentDetails([FromBody] CustomerBank paymentDetails) { Guid guid = Guid.NewGuid(); string reference = guid.ToString(); if (paymentDetails.CardNumber.Equals(CardNumber) && (paymentDetails.Amount >= Amount)) { //generate a reference reference = guid.ToString(); paymentDetails.Reference = reference; paymentDetails.Status = "successful"; return(Ok(paymentDetails)); } else { paymentDetails.Status = "unsuccessful"; } return(BadRequest(paymentDetails)); }
public static CustomerBankDTO ConvertTocustomerBankDto(CustomerBank customerBank) { CustomerBankDTO customerBankDto = new CustomerBankDTO(); if (customerBank != null) { customerBankDto.CustomerBankId = customerBank.CustomerBankId; customerBankDto.CustomerId = customerBank.CustomerId.GetValueOrDefault(); customerBankDto.IFSCCode = customerBank.IFSCCode; customerBankDto.AccountNo = customerBank.AccountNo; customerBankDto.Branch = customerBank.Branch; customerBankDto.BankName = customerBank.BankName; customerBankDto.AccountHolderName = customerBank.AccountHolderName; customerBankDto.UPIId = customerBank.UPIId; customerBankDto.CreatedBy = customerBank.CreatedBy; customerBankDto.CreatedDate = customerBank.CreatedDate; customerBankDto.IsDeleted = customerBank.IsDeleted; customerBankDto.ModifiedBy = customerBank.ModifiedBy; customerBankDto.ModifiedDate = customerBank.ModifiedDate; } return(customerBankDto); }
static void Main(string[] args) { //Läser in textfil StreamReader textReader = new StreamReader("bankdata.txt"); Console.WriteLine("Textfilen inläst."); CustomerBank customerInfo = new CustomerBank(); customerInfo.ReadFromTextFile(textReader); while (true) { Console.WriteLine("HUVUDMENY\n0) Avsluta och spara\n1) Sök kund\n2) Visa kundbild\n3) Skapa kund\n" + "4) Ta bort kund\n5) Skapa konto\n6) Ta bort konto\n7) Insättning\n8) Uttag\n9) Överföring"); string choice = Console.ReadLine(); switch (choice) { case "0": { //Sparar textfil customerInfo.SaveToFile(); Console.WriteLine("Textfil sparad."); Enter(); break; } case "1": { Console.WriteLine("Sök kund\nSök på namn eller postnummer: "); choice = Console.ReadLine(); customerInfo.SearchCustomer(choice); Enter(); break; } case "2": { Console.Write("Visa kundbild\nSök på kundnummer eller kontonummer: "); choice = Console.ReadLine(); customerInfo.ShowCustomer(choice); Enter(); break; } case "3": { Console.WriteLine("Skapa ny kund: "); customerInfo.CreateCustomer(); Enter(); break; } case "4": { Console.WriteLine("Ta bort kund\nSkriv in kundnummer: "); choice = Console.ReadLine(); customerInfo.DeleteCustomer(choice); Enter(); break; } case "5": { Console.WriteLine("Skapa konto\nAnge kundnummer: "); choice = Console.ReadLine(); customerInfo.NewAccount(choice); Enter(); break; } case "6": { Console.WriteLine("Ta bort konto:\nAnge kontonummer: "); choice = Console.ReadLine(); customerInfo.DeleteAccount(choice); Enter(); break; } case "7": { Console.WriteLine("Insättning\nAnge kontonummer: "); choice = Console.ReadLine(); customerInfo.Deposit(choice); Enter(); break; } case "8": { Console.WriteLine("Uttag\nAnge kontonummer: "); choice = Console.ReadLine(); Console.WriteLine("Ange belopp: "); decimal amount = decimal.Parse(Console.ReadLine()); customerInfo.WithDraw(choice, amount); Enter(); break; } case "9": { Console.WriteLine("Överföring från kontonummer: "); string fromAccount = Console.ReadLine(); Console.WriteLine("Till kontonummer: "); string toAccount = Console.ReadLine(); customerInfo.Transaction(fromAccount, toAccount); Enter(); break; } default: { Enter(); break; } } } }