public async Task <ContestCategoryModel> SaveCategory(ContestCategoryModel categoryModel) { var category = _mapper.Map <ContestCategory>(categoryModel); await _repository.Save(category); categoryModel.Id = category.Id; return(categoryModel); }
public async Task <IActionResult> Remove([FromBody] ContestCategoryModel category) { try { await _categoriesService.RemoveCategory(category.Id); return(Ok(category.Id)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> Save([FromBody] ContestCategoryModel category) { try { var savedCategory = await _categoriesService.SaveCategory(category); return(Created("Add", savedCategory)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }