public int DeleteFoodItem(int foodid) { tbl_fooditems tf = _db.tbl_fooditems.Where(c => c.Id == foodid).FirstOrDefault(); _db.tbl_fooditems.Remove(tf); return(_db.SaveChanges()); }
public int UpdateFoodItem(FoodItemDetails fd) { tbl_fooditems tf = _db.tbl_fooditems.Where(c => c.Id == fd.Id).FirstOrDefault(); tf.CategoryName = fd.CategoryName; tf.Price = fd.Price; tf.Status = Convert.ToByte(fd.Status); tf.IsSpecial = Convert.ToByte(fd.IsSpecial); tf.Discount = fd.Discount; tf.Image = fd.Image; tf.FoodName = fd.FoodName; return(_db.SaveChanges()); }
public int AddNewFoodItem(FoodItemDetails fd) { tbl_fooditems tf = new tbl_fooditems(); tf.CategoryName = fd.CategoryName; tf.Price = fd.Price; tf.Status = Convert.ToByte(fd.Status); tf.IsSpecial = Convert.ToByte(fd.IsSpecial); tf.Discount = fd.Discount; tf.Image = fd.Image; tf.FoodName = fd.FoodName; _db.tbl_fooditems.Add(tf); return(_db.SaveChanges()); }