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

            if (res.Success)
            {
                if (res.Result == null)
                {
                    return(NotFound());
                }
                var vm = CompanyViewModel.Parse(res.Result);
                return(vm);
            }
            else
            {
                return(new ObjectResult(HttpStatusCode.InternalServerError));
            }
        }
示例#2
0
        public void TestCreateAndReadCompany()
        {
            ContextSeeder.Seed();
            var bo        = new CompanyBusinessObject();
            var com       = new Company("Sonae", 12345);
            var resCreate = bo.Create(com);
            var resGet    = bo.Read(com.Id);

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
        public ActionResult <CompanyViewModel> Get(Guid id)
        {
            var res = _bo.Read(id);

            if (res.Success)
            {
                if (res.Result == null)
                {
                    return(NotFound());
                }
                var cvm = new CompanyViewModel()
                {
                    Id   = res.Result.Id,
                    Name = res.Result.Name
                };

                return(cvm);
            }

            else
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError));
            }
        }
示例#4
0
        public void TestCreateCompany()
        {
            BoraNowSeeder.Seed();
            var cbo = new CompanyBusinessObject();
            var pbo = new ProfileBusinessObject();

            var profile = new Profile("EE", "AA");

            pbo.Create(profile);

            var company = new Company("B", "C", "123", "234", profile.Id);

            var resCreate = cbo.Create(company);
            var resGet    = cbo.Read(company.Id);

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