public ActionResult Loan(Models.Loan_174797_Project user) { if (Session["Email"] != null) { try { if (ModelState.IsValid) { using (var db = new Training_20Feb_MumbaiEntities2()) { var newUser = db.Loan_174797_Project.Create(); newUser.AccountID = user.AccountID; newUser.Email = user.Email; newUser.TypeofLoan = user.TypeofLoan; newUser.Loanammount = user.Loanammount; newUser.DurationofLoan = user.DurationofLoan; newUser.EMI = user.EMI; newUser.Applicationstatus = "In Progress..."; db.Loan_174797_Project.Add(newUser); db.SaveChanges(); ViewBag.Message = "Successfully applied for the laon"; return(RedirectToAction("Index", "Home")); } } else { ModelState.AddModelError("", "Data is not correct"); } } catch (System.Data.Entity.Validation.DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } throw; } return(View()); } else { return(RedirectToAction("LogIn", "Registration")); } }
public List <Account_Master_174797_Project> getAll() { try { using (Training_20Feb_MumbaiEntities2 db = new Training_20Feb_MumbaiEntities2()) { return(db.Account_Master_174797_Project.ToList()); } } catch (Exception ex) { throw ex; } }
public Account_Master_174797_Project getById(int accountNo) { try { using (Training_20Feb_MumbaiEntities2 db = new Training_20Feb_MumbaiEntities2()) { return(db.Account_Master_174797_Project.SingleOrDefault(a => a.Account_No == accountNo)); } } catch (Exception ex) { throw ex; } }
public List <Payee> GetAll() { try { using (Training_20Feb_MumbaiEntities2 db = new Training_20Feb_MumbaiEntities2()) { return(db.Payees.ToList()); } } catch (Exception ex) { throw ex; } }
public List <BillPay> GetAllIncludePayeeById(int id) { try { using (Training_20Feb_MumbaiEntities2 db = new Training_20Feb_MumbaiEntities2()) { return(db.BillPays.Include("Payee").Include("Account_Master_174797_Project").Where(b => b.Account_Master_174797_Project.Account_No == id).ToList()); } } catch (Exception ex) { throw ex; } }
public List <BillPay> GetAllIncludePayee() { try { using (Training_20Feb_MumbaiEntities2 db = new Training_20Feb_MumbaiEntities2()) { return(db.BillPays.Include("Payee").ToList()); } } catch (Exception ex) { throw ex; } }
public BillPay GetById(int billPayId) { try { using (Training_20Feb_MumbaiEntities2 db = new Training_20Feb_MumbaiEntities2()) { return(db.BillPays.SingleOrDefault(c => c.BillPayID == billPayId)); } } catch (Exception ex) { throw ex; } }
public ActionResult ForgotPassword(string Email, string PassWord) { Training_20Feb_MumbaiEntities2 tr = new Training_20Feb_MumbaiEntities2(); var details = tr.Account_Master_174797_Project.Single(u => u.Email == Email); if (details != null) { details.PassWord = PassWord; if (TryUpdateModel(details)) { tr.SaveChanges(); return(RedirectToAction("LogIn")); } } return(View()); }
public ActionResult Register(Models.Account_Master_174797_Project user) { try { if (ModelState.IsValid) { using (var db = new Training_20Feb_MumbaiEntities2()) { var newUser = db.Account_Master_174797_Project.Create(); newUser.Account_No = user.Account_No; newUser.Account_Type = user.Account_Type; newUser.Username = user.Username; newUser.PassWord = user.PassWord; //newUser.Balance = user.Balance; newUser.Balance = 10000; newUser.Opening_Date = user.Opening_Date; newUser.Email = user.Email; newUser.HouseAddress = user.HouseAddress; newUser.Pancard_no = user.Pancard_no; newUser.AccountaccessMode = user.AccountaccessMode; db.Account_Master_174797_Project.Add(newUser); db.SaveChanges(); return(RedirectToAction("LogIn", "Registration")); } } else { ModelState.AddModelError("", "Data is not correct"); } } catch (System.Data.Entity.Validation.DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } throw; } return(View()); }
private bool IsValid(string email, string password) { bool IsValid = false; using (var db = new Training_20Feb_MumbaiEntities2()) { var user = db.Account_Master_174797_Project.FirstOrDefault(u => u.Email == email); if (user != null) { if (user.PassWord == password) { IsValid = true; } } return(IsValid); } }
//public List<Account_Master_174797_Project> getByAccount_No(int accountno) //{ // try // { // using (Training_20Feb_MumbaiEntities2 db = new Training_20Feb_MumbaiEntities2()) // { // return db.Account_Master_174797_Project.Where(a => a.Account_No == accountno).ToList(); // } // } // catch (Exception ex) // { // throw ex; // } //} public string getAccountTypeByNo(int accountNumber) { try { using (Training_20Feb_MumbaiEntities2 db = new Training_20Feb_MumbaiEntities2()) { string accountType = (from t in db.Account_Master_174797_Project where t.Account_No == accountNumber select t.Account_Type).FirstOrDefault(); return(accountType); } } catch (Exception ex) { throw ex; } }
public List <BillPay> GetActive() { try { using (Training_20Feb_MumbaiEntities2 db = new Training_20Feb_MumbaiEntities2()) { var query = from t in db.BillPays where t.ScheduleDate > DateTime.Now && t.Status == "Y" select t; return(query.ToList()); } } catch (Exception ex) { throw ex; } }
public BillPay CreateBillPay(int accountNo, int payeeId, decimal amount, DateTime scheduleDate, string period) { try { using (Training_20Feb_MumbaiEntities2 db = new Training_20Feb_MumbaiEntities2()) { BillPay billPay = new BillPay(); billPay.Account_No = accountNo; billPay.PayeeID = payeeId; billPay.Amount = amount; billPay.ScheduleDate = scheduleDate; billPay.Period = period; billPay.Status = "Y"; billPay.ModifyDate = DateTime.Now; db.BillPays.Add(billPay); db.SaveChanges(); return(billPay); } } catch (Exception ex) { throw ex; } }