コード例 #1
0
        public void TestCreateAndReadBrand()
        {
            ContextSeeder.Seed();
            var bo        = new BrandBusinessObject();
            var reg       = new Brand("Dona Ermelinda");
            var resCreate = bo.Create(reg);
            var resGet    = bo.Read(reg.Id);

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

            if (res.Success)
            {
                if (res.Result == null)
                {
                    return(NotFound());
                }
                var bvm = new BrandViewModel();
                bvm.Id   = res.Result.Id;
                bvm.Name = res.Result.Name;
                return(bvm);
            }

            else
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError));
            }
        }