Exemplo n.º 1
0
        public async Task InsertGlossaryItems()
        {
            var subject = new GlossaryRepository();

            for (var i = 0; i < 100; i++)
            {
                await subject.CreateAsync(new Data.Entity.GlossaryItem
                {
                    Content = Lorem.Sentence(100),
                    Title   = Lorem.Sentence(2)
                });
            }
        }
Exemplo n.º 2
0
        public async Task <ActionResult> CreateAsync(GlossaryItemViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var item = new GlossaryItem
                {
                    Title   = viewModel.Title,
                    Content = viewModel.Content
                };
                await _glossaryRepository.CreateAsync(item);

                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(View("CreateEdit", viewModel));
            }
        }