Exemplo n.º 1
0
        public ActionResult <MenuViewModel> Get(Guid id)
        {
            var res = _bo.Read(id);

            if (res.Success)
            {
                if (res.Result == null)
                {
                    return(NotFound());
                }
                var drvm = MenuViewModel.Parse(res.Result);
                return(drvm);
            }
            else
            {
                return(new ObjectResult(HttpStatusCode.InternalServerError));
            }
        }
        public ActionResult <MenuViewModel> Get(Guid id)
        {
            var res = _bo.Read(id);

            if (res.Success)
            {
                if (res.Result == null)
                {
                    return(NotFound());
                }
                var vm = MenuViewModel.Parse(res.Result);
                return(vm);
            }
            else
            {
                return(InternalServerError());
            }
        }
Exemplo n.º 3
0
        public void TestCreateAndListMenu()
        {
            RestaurantSeeder.Seed();
            var mbo  = new MealBusinessObject();
            var rbo  = new RestaurantBusinessObject();
            var mebo = new MenuBusinessObject();

            var m = mbo.List().Result.First();
            var r = rbo.List().Result.First();

            var dr        = new Menu(DateTime.Now, r.Id, m.Id);
            var resCreate = mebo.Create(dr);
            var resGet    = mebo.Read(dr.Id);

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
Exemplo n.º 4
0
        public void TestCreateMenu()
        {
            ContextSeeders.Seed();
            var mbo = new MenuBusinessObject();

            var rbo    = new RestaurantBusinessObject();
            var mealbo = new MealBusinessObject();

            var restaurant = new Restaurant("a", "b", "c", "d", "f", 6);
            var meal       = new Meal("a", "b", "c");

            rbo.Create(restaurant);
            mealbo.Create(meal);

            var menu = new Menu(DateTime.Now, restaurant.Id, meal.Id);

            var resCreate = mbo.Create(menu);
            var resGet    = mbo.Read(menu.Id);

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }