コード例 #1
0
        public void TestCreateAndReadDietaryRestriction()
        {
            RestaurantSeeder.SeedCountries();
            var bo        = new DietaryRestrictionBusinessObject();
            var dr        = new DietaryRestriction("Vegetarian");
            var resCreate = bo.Create(dr);
            var resGet    = bo.Read(dr.Id);

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
コード例 #2
0
        public ActionResult <DietaryRestrictionViewModel> Get(Guid id)
        {
            var res = _bo.Read(id);

            if (res.Success)
            {
                if (res.Result == null)
                {
                    return(NotFound());
                }

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

            if (res.Success)
            {
                if (res.Result == null)
                {
                    return(NotFound());
                }
                //if(res.Result.UpdatedAt != DateTime.Now) return StatusCode((int)HttpStatusCode.InternalServerError);
                var drvm = DietaryRestrictionViewModel.Parse(res.Result);
                return(drvm);
            }
            else
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError));
            }
        }
コード例 #4
0
        public void TestCreateDietaryRestriction()
        {
            ContextSeeders.Seed();
            var mbo = new DietaryRestrictionBusinessObject();

            var dietaryRestriction = new DietaryRestriction("Vegan");
            var resCreate          = mbo.Create(dietaryRestriction);
            var resGet             = mbo.Read(dietaryRestriction.Id);

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