Ejemplo n.º 1
0
        public void StartGame()
        {
            var categories = _service.GetAll().ToList();

            if (!ProccessCategories(categories))
            {
                var newCategory = ProccessDish(_fallbackDish);
                if (newCategory != null)
                {
                    _service.Add(newCategory);
                }
            }
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Cadastrar uma nova Categoria
 /// </summary>
 // POST: api/Categories
 public void Post([FromBody] CategoryViewModel obj)
 {
     _categoryApp.Add(_mapper.Map <Category>(obj));
 }
Ejemplo n.º 7
0
        public ActionResult <CategoryDto> Post([FromBody] CategoryCreateDto dto)
        {
            CategoryDto category = _app.Add(dto);

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