Exemple #1
0
        public async Task Should_Create_New()
        {
            _repository.FirstOrDefaultAsync(Arg.Any <Expression <Func <Category, bool> > >()).Returns(Task.FromResult((Category)null));
            var category = await _manager.CreateCategory("test");

            category.Name.ShouldBe("test");
        }
Exemple #2
0
        public async Task <IActionResult> CreateCategory([FromBody] CategoryDTO category)
        {
            var newCategory = _mapper.Map <Category>(category);
            await _categoryManager.CreateCategory(newCategory);

            return(Ok());
        }
Exemple #3
0
        public async Task <Response> Do(Request request)
        {
            var category = new Category
            {
                Name     = request.Name,
                ParentId = request.ParentId
            };

            if (await _categoryManager.CreateCategory(category) <= 0)
            {
                throw new System.Exception("ERROR CREATING CATEGORY");
            }
            ;

            return(new Response
            {
                Id = category.Id,
                Name = category.Name,
                ParentId = category.ParentId
            });
        }
        // POST: /Inventory/Employee/CreateEmployee

        public JsonResult CreateCategory(InvCategory aObj)
        {
            var data = _aManager.CreateCategory(aObj);

            return(Json(new { success = data.Status, data }, JsonRequestBehavior.AllowGet));
        }
Exemple #5
0
        public async Task CreateCategoryAsync(CreateUpdateCategoryInput input)
        {
            var category = await _categoryManager.CreateCategory(input.Name);

            await _repository.CreateAsync(category);
        }