예제 #1
0
        public void StartGame()
        {
            var categories = _service.GetAll().ToList();

            if (!ProccessCategories(categories))
            {
                var newCategory = ProccessDish(_fallbackDish);
                if (newCategory != null)
                {
                    _service.Add(newCategory);
                }
            }
        }
예제 #2
0
        public async Task <JsonResult> Add(AddCategoryDto model)
        {
            var result = await _categoryAppService.Add(model);

            OutputModel outputModel = new OutputModel();

            outputModel.Data = result;
            return(new JsonResult(outputModel));
        }
예제 #3
0
        public ActionResult Create(CategoryViewModel category)
        {
            if (ModelState.IsValid)
            {
                var categoryDomain = Mapper.Map <CategoryViewModel, Category>(category);
                _categoryApp.Add(categoryDomain);

                return(RedirectToAction("Index"));
            }
            return(View(category));
        }
        public ActionResult Create(CategoryViewModel category)
        {
            try
            {
                _categoryAppService.Add(category);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
 public void Post(CategoryDto category)
 {
     _categoryAppService.Add(category);
 }
예제 #6
0
 /// <summary>
 /// Cadastrar uma nova Categoria
 /// </summary>
 // POST: api/Categories
 public void Post([FromBody] CategoryViewModel obj)
 {
     _categoryApp.Add(_mapper.Map <Category>(obj));
 }
예제 #7
0
        public ActionResult <CategoryDto> Post([FromBody] CategoryCreateDto dto)
        {
            CategoryDto category = _app.Add(dto);

            return(CreatedAtAction(nameof(Get), new { id = category.Id }, category));
        }
예제 #8
0
 public ActionResult Add(AddCategoryDto dto)
 {
     _categoryAppService.Add(dto);
     return(View());
 }