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

            if (res.Success)
            {
                if (res.Result == null)
                {
                    return(NotFound());
                }
                var sbvm = new ShoppingBasketViewModel();
                sbvm.Id        = res.Result.Id;
                sbvm.ProfileId = res.Result.ProfileId;
                return(sbvm);
            }

            else
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError));
            }
        }
Example #2
0
        public void TestCreateAndReadShoppingBasket()
        {
            ContextSeeder.Seed();
            var bo        = new ShoppingBasketBusinessObject();
            var pbo       = new ProfileBusinessObject();
            var pro       = pbo.List().Result.FirstOrDefault();
            var com       = new ShoppingBasket(pro.Id);
            var resCreate = bo.Create(com);
            var resGet    = bo.Read(com.Id);

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
        public void TestCreateAndReadShoppingBasket()
        {
            ContextSeeder.Seed();
            var sbo       = new ShoppingBasketBusinessObject();
            var ebo       = new EstablishmentBusinessObject();
            var resList   = ebo.List();
            var item      = resList.Result.FirstOrDefault();
            var sb        = new ShoppingBasket(item.Id);
            var resCreate = sbo.Create(sb);
            var resGet    = sbo.Read(sb.Id);

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