Esempio n. 1
0
        public ActionResult <VisitorViewModel> Get(Guid id)
        {
            var res = _bo.Read(id);

            if (res.Success)
            {
                if (res.Result == null)
                {
                    return(NotFound());
                }
                var vm = VisitorViewModel.Parse(res.Result);
                return(vm);
            }
            else
            {
                return(new ObjectResult(HttpStatusCode.InternalServerError));
            }
        }
Esempio n. 2
0
        public void TestCreateVisitor()
        {
            BoraNowSeeder.Seed();
            var vbo = new VisitorBusinessObject();

            var countrybo = new CountryBusinessObject();
            var pbo       = new ProfileBusinessObject();
            var companybo = new CompanyBusinessObject();

            var country = new Country("Holanda");
            var profile = new Profile("a", "b");
            var company = new Company("a", "b", "c", "d", profile.Id);

            countrybo.Create(country);
            pbo.Create(profile);
            companybo.Create(company);

            var visitor = new Visitor("m", "f", DateTime.Now.AddYears(-24), "m", profile.Id, country.Id);

            var resCreate = vbo.Create(visitor);
            var restGet   = vbo.Read(visitor.Id);

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