示例#1
0
 public static void DeleteBarLogic(int?id)
 {
     using (BarTrackerDBEntities db = new BarTrackerDBEntities())
     {
         var delbar = db.Bar.SingleOrDefault(x => x.BarId == id);
         db.Bar.Remove(delbar);
         db.SaveChanges();
     }
 }
示例#2
0
 public static void RegistrationLogic(string LoginReg, string PasswordReg, string EmailReg)
 {
     using (BarTrackerDBEntities db = new BarTrackerDBEntities())
     {
         db.User.Add(new User {
             Username = LoginReg, Password = PasswordReg, Email = EmailReg
         });
         db.SaveChanges();
     }
 }
示例#3
0
 public static void AddBarLogic(Bar bar)
 {
     if (bar.BarName != "" && bar.Category != "" && bar.City != "")
     {
         using (BarTrackerDBEntities db = new BarTrackerDBEntities())
         {
             db.Bar.Add(bar);
             db.SaveChanges();
         }
     }
 }
示例#4
0
        public static Bar EditBarLogic(Bar bar)
        {
            Bar Fullbar = new Bar();

            using (BarTrackerDBEntities db = new BarTrackerDBEntities())
            {
                Bar oldBar = db.Bar.SingleOrDefault(x => x.BarId == bar.BarId);
                oldBar.BarName  = bar.BarName;
                oldBar.Category = bar.Category;
                oldBar.City     = bar.City;
                db.SaveChanges();
                Fullbar = db.Bar.Include(x => x.Rating).FirstOrDefault(x => x.BarId == bar.BarId);
            }
            return(Fullbar);
        }