public int Add(string code, string name)
 {
     using (ChooseDishesEntities entities = new ChooseDishesEntities())
     {
         DishesMenu menu = DishesMenuModel.build(code, name, 1000);
         entities.DishesMenu.Add(menu);
         entities.SaveChanges();
         return(menu.MenusId);
     }
 }
Пример #2
0
 public int Add(string code, string name)
 {
     using (ChooseDishesEntities entities = new ChooseDishesEntities())
     {
         var list = entities.DishesMenu.Where(t => t.Deleted == 0 && (t.Code == code || t.Name == name)).ToList();
         if (list != null && list.Count > 0)
         {
             return(0);
         }
         DishesMenu menu = DishesMenuModel.build(code, name, SubjectUtils.GetAuthenticationId());
         entities.DishesMenu.Add(menu);
         entities.SaveChanges();
         return(menu.MenusId);
     }
 }