Exemplo n.º 1
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            CategoryRepository categoryRepository = new CategoryRepository();

            categoryRepository.CreateCategory(txtName.Text, txtDescription.Text, listView1);
            categoryRepository.Eraser(groupBox1);
        }
Exemplo n.º 2
0
        public void TestAddcategory()
        {
            var validCategory = new Category()
            {
                CategoryName = "Education",
                UrlSlug      = "education",
                Description  = "education news",
            };

            categoryRepository.CreateCategory(validCategory);
            Assert.AreEqual(4, categoryRepository.GetAllCategories().Count);
        }
        public async Task <IHttpActionResult> CreateCategory()
        {
            Category category = new Category()
            {
                Name    = "Building",
                Details = "Category for all the Building related odd jobs / services"
            };

            await _repo.CreateCategory(category);

            return(Ok(String.Format("The category {0} has been successfully created", category.Name)));
        }
        public async Task PostCategory_Success()
        {
            var dbContext = _fixture.Context;
            var category  = new Category {
                CategoryName = "Test category"
            };

            var repository = new CategoryRepository(dbContext);
            var result     = await repository.CreateCategory(category);

            Assert.True(result);
            Assert.NotEmpty(await repository.ReadAllCategory());
        }
Exemplo n.º 5
0
        public IActionResult Create(Category cgy)
        {
            try
            {
                _categoryRepository.CreateCategory(cgy);

                return(RedirectToAction("Index", new { id = cgy.Id }));
            }
            catch
            {
                return(View(cgy));
            }
        }
Exemplo n.º 6
0
        public ActionResult Create(Category model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _repo.CreateCategory(model);
                }
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                // log
            }

            return(View(model));
        }
Exemplo n.º 7
0
 public CategoryDto CreateCategory(CategoryInputModel body)
 {
     return(_categoryRepo.CreateCategory(body));
 }
Exemplo n.º 8
0
 public int CreateCategory(CategoryInputModel category)
 {
     return(_categoryRepository.CreateCategory(category));
 }
 public CategoryDetailDto CreateCategory(CategoryInputModel model)
 {
     return(_categoryRepository.CreateCategory(model));
 }
Exemplo n.º 10
0
 public ActionResult <Category> CreateCategory(Category category)
 {
     categoryRepository.CreateCategory(category);
     return(CreatedAtAction("GetCategory", new { id = category.Id }, category));
 }