public void TestCreateCategoryInterestPointAsync()
        {
            BoraNowSeeder.Seed();
            var cipbo = new CategoryInterestPointBusinessObject();

            var categoryInterestPoint = new CategoryInterestPoint("B");


            var resCreate = cipbo.CreateAsync(categoryInterestPoint).Result;
            var resGet    = cipbo.ReadAsync(categoryInterestPoint.Id).Result;

            Assert.IsTrue(resGet.Success && resCreate.Success && resGet.Result != null);
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("Name")] CategoryInterestPointViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var categoryInterestPoint = vm.ToCategoryInterestPoint();
                var createOperation       = await _bo.CreateAsync(categoryInterestPoint);

                if (!createOperation.Success)
                {
                    return(OperationErrorBackToIndex(createOperation.Exception));
                }
                else
                {
                    return(OperationSuccess("The record was successfuly created"));
                }
            }
            return(View(vm));
        }