/// <summary> /// 餐馆删除订单 /// </summary> /// <param name="orderId"></param> /// <returns></returns> public static bool ShopDeleteOrder(int orderId) { var order = _entities.Ye_Order.SingleOrDefault(p => p.OrderID == orderId); if (order == null) { return(false); } order.IsShopDeleted = true; return(_entities.SaveChanges() > 0); }
/// <summary> /// 管理员登录 /// </summary> /// <param name="account">账号名</param> /// <param name="password">密码</param> /// <returns></returns> public static Ye_Administrator Login(string account, string password) { var admin = _entities.Ye_Administrator.FirstOrDefault(a => a.Account == account && a.Password == password); if (admin != null) { admin.LastLoginTime = DateTime.Now; _entities.SaveChanges(); } return(admin); }
/// <summary> /// 添加菜单 /// </summary> /// <param name="product">菜单</param> /// <returns></returns> public static bool AddProduct(Ye_Product product) { _entities.Ye_Product.Add(product); return(_entities.SaveChanges() > 0); }
/// <summary> /// 添加优惠券 /// </summary> /// <param name="shopCoupon"></param> /// <returns></returns> public static bool AddShopCoupon(Ye_ShopCoupon shopCoupon) { _entities.Ye_ShopCoupon.Add(shopCoupon); return(_entities.SaveChanges() > 0); }
/// <summary> /// 添加用户 /// </summary> /// <param name="user"></param> /// <returns></returns> public static bool AddUser(Ye_User user) { _entities.Ye_User.Add(user); return(_entities.SaveChanges() > 0); }
/// <summary> /// 添加用户优惠券 /// </summary> /// <param name="userCoupon"></param> /// <returns></returns> public static bool AddShopCoupon4User(Ye_UserCoupon userCoupon) { _entities.Ye_UserCoupon.Add(userCoupon); return(_entities.SaveChanges() > 0); }
/// <summary> /// 修改管理登录密码 /// </summary> /// <param name="yeShopId">餐馆 Id</param> /// <param name="newPwd">新密码</param> /// <returns></returns> public static bool ChangePassword(int yeShopId, string newPwd) { var shop = GetShopById(yeShopId); shop.ShopPassword = newPwd; return(_entities.SaveChanges() > 0); }