public async Task <IActionResult> Create(LegalActionInputModel model)
        {
            if (ModelState.IsValid)
            {
                await this.service.CreateAsync(model);

                return(this.RedirectToAction("All"));
            }
            return(this.View(model));
        }
Ejemplo n.º 2
0
        public async Task CreateAsync(LegalActionInputModel model)
        {
            var legalAction = new LegalAction
            {
                ActionName = model.ActionName
            };

            await this.dbContext.LegalActions.AddAsync(legalAction);

            await this.dbContext.SaveChangesAsync();
        }
Ejemplo n.º 3
0
        public void LegalActionCreateTest()
        {
            var optionBuilder = new DbContextOptionsBuilder <ApplicationDbContext>()
                                .UseInMemoryDatabase("testDb1");
            var dbContext = new ApplicationDbContext(optionBuilder.Options);

            var service = new LegalActionService(dbContext);

            var createModel = new LegalActionInputModel
            {
                ActionName = "someAction",
            };

            var result = service.CreateAsync(createModel);

            Assert.NotNull(result);
            //Assert.Equal(2, result.Id);
        }