public bool AddBranch(Branch obj) { try { //StreamWriter writer = new StreamWriter("Files/branches.txt", true); //writer.WriteLine(obj.Name + ","); ////+"," + obj.DateOfBirth //writer.Flush(); //writer.Close(); AccountsDbEntities1 db = new AccountsDbEntities1(); BranchTable bt = new BranchTable(); bt.Name = obj.Name; db.BranchTables.Add(bt); db.SaveChanges(); return(true); } catch (Exception ex) { Console.WriteLine("Error Exception"); return(false); } }
public bool AddReservation() { try { AccountsDbEntities1 a = new AccountsDbEntities1(); reservation_table rs = new reservation_table(); dbObj.FirstName = obj.FirstName; dbObj.LastName = obj.LastName; dbObj.Contact = obj.Contact; dbObj.Email = obj.Email; db.AccountsTables.Add(dbObj); db.SaveChanges(); Console.WriteLine("IN the controller try"); return(true); } catch (Exception ex) { Console.WriteLine("IN the controller catch"); return(false); } return(true); }