public void StartGame() { var categories = _service.GetAll().ToList(); if (!ProccessCategories(categories)) { var newCategory = ProccessDish(_fallbackDish); if (newCategory != null) { _service.Add(newCategory); } } }
public async Task <JsonResult> Add(AddCategoryDto model) { var result = await _categoryAppService.Add(model); OutputModel outputModel = new OutputModel(); outputModel.Data = result; return(new JsonResult(outputModel)); }
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); }
/// <summary> /// Cadastrar uma nova Categoria /// </summary> // POST: api/Categories public void Post([FromBody] CategoryViewModel obj) { _categoryApp.Add(_mapper.Map <Category>(obj)); }
public ActionResult <CategoryDto> Post([FromBody] CategoryCreateDto dto) { CategoryDto category = _app.Add(dto); return(CreatedAtAction(nameof(Get), new { id = category.Id }, category)); }
public ActionResult Add(AddCategoryDto dto) { _categoryAppService.Add(dto); return(View()); }