public CategoryDto CreateNewCategory(SecurityContext securityContext, NewCategoryMessage newCategoryMessage) { if (newCategoryMessage == null) { throw new ArgumentNullException(nameof(newCategoryMessage)); } var category = _categoryFactory.Create( newCategoryMessage.Name, _noteFactory, _subscriberFactory ); category = _categoryRepository.Add(category); return(_mapper.Map <CategoryDto>(category)); }
public IActionResult Post([FromBody] NewCategoryMessage newCategoryMessage) { var categoryDto = _noteTaker.CreateNewCategory(SecurityContext, newCategoryMessage); return(CreatedAtAction("Get", new { id = categoryDto.Id }, categoryDto)); }