Пример #1
0
 public static void CreateDish(Dish dish)
 {
     using(var db = new DataContext())
     {
         var rest = db.Restaurants.Find(dish.Restaurant.Id);
         dish.Restaurant = rest;
         rest.Dishes.Add(dish);
         db.SaveChanges();
     }
 }
Пример #2
0
 private static DishViewModel CreateDishViewModel(Dish d)
 {
     return new DishViewModel
     {
         Id = d.Id, ShortName = d.ShortName,
         Description = d.Description, DishType = d.DishType.ToString(),
         ResturantName = d.Restaurant.Name, ResturantId = d.Restaurant.Id,
         KitchenType = d.KitchenType.ToString()
     };
 }