Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("InterestPointId, ResultId")] ResultInterestPointViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var rip             = vm.ToResultInterestPoint();
                var createOperation = await _bo.CreateAsync(rip);

                if (!createOperation.Success)
                {
                    return(OperationErrorBackToIndex(createOperation.Exception));
                }
                return(OperationSuccess("The record was successfuly created"));
            }
            return(View(vm));
        }
Ejemplo n.º 2
0
        public void TestCreateResultInterestPointAsync()
        {
            var ripbo = new ResultInterestPointBusinessObject();
            var rbo   = new ResultBusinessObject();
            var ipbo  = new InterestPointBusinessObject();

            var vbo = new VisitorBusinessObject();

            var qbo  = new QuizBusinessObject();
            var quiz = new Quiz("Quiz 1");

            qbo.Create(quiz);

            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("A", "C", DateTime.Now, "M", profile.Id, country.Id);

            vbo.Create(visitor);

            var result = new Result("Quiz 1", DateTime.UtcNow, quiz.Id, visitor.Id);

            var interestPoint = new InterestPoint("Bar do Rui", "Pesticos&Cocktails", "Rua dos Anjos", "C://images", "14h", "00h", "Sabados", true, true, company.Id);

            rbo.Create(result);
            ipbo.Create(interestPoint);

            var _resultInterestPoint = new ResultInterestPoint(result.Id, interestPoint.Id);


            var resCreate = ripbo.CreateAsync(_resultInterestPoint).Result;
            var resGet    = ripbo.ReadAsync(_resultInterestPoint.Id).Result;

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