Beispiel #1
0
        public async Task <IActionResult> Modify([Required] Guid idx, [FromBody] CreateCategoryRequest request)
        {
            if (!TryValidateModel(request, nameof(request)))
            {
                return(BadRequest("Invalid Data"));
            }

            var r = await _repo.Update(idx, new Category(idx, request.Name));

            return(Ok(r));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([FromBody] CreateCategoryRequest request)
        {
            if (!TryValidateModel(request, nameof(request)))
            {
                return(BadRequest("Invalid Data"));
            }

            var r = await _repo.Create(new Category(Guid.NewGuid(), request.Name));

            return(Ok(r));
        }