Exemple #1
0
        public ActionResult <RestaurantViewModel> Get(Guid id)
        {
            var res = _bo.Read(id);

            if (res.Success)
            {
                if (res.Result == null)
                {
                    return(NotFound());
                }
                var vm = RestaurantViewModel.Parse(res.Result);
                return(vm);
            }
            else
            {
                return(InternalServerError());
            }
        }
        public ActionResult <RestaurantViewModel> Get(Guid id)
        {
            var res = _bo.Read(id);

            if (res.Success)
            {
                if (res.Result == null)
                {
                    return(NotFound());
                }
                var rvm = RestaurantViewModel.Parse(res.Result);
                return(rvm);
            }
            else
            {
                return(new ObjectResult(HttpStatusCode.InternalServerError));
            }
        }
        public void TestCreateAndReadRestaurant()
        {
            RestaurantSeeder.SeedCountries();
            var bo        = new RestaurantBusinessObject();
            var rs        = new Restaurant("Jade", "Avenida da Liberdade antes da rotunda", "13h00", "23h00", "monday", 24);
            var resCreate = bo.Create(rs);
            var resGet    = bo.Read(rs.Id);

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
Exemple #4
0
        public void TestCreateAndListRestaurant()
        {
            RestaurantSeeder.Seed();
            var dbo       = new RestaurantBusinessObject();
            var dr        = new Restaurant("asdasd", "owewq", "123", "1232", "23ed", 4);
            var resCreate = dbo.Create(dr);
            var resGet    = dbo.Read(dr.Id);

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