public async Task <dynamic> DeleteCategory(string categoryId) { string userId = Request.Query .SingleOrDefault(q => string.Compare(q.Key, "userId", StringComparison.OrdinalIgnoreCase) == 0) .Value; if (string.IsNullOrEmpty(userId) || string.IsNullOrEmpty(categoryId)) { return(BadRequest("Missing parameters in request, userId/categoryId")); } try { return(await _crudService.DeleteCategoryAsync(userId, categoryId)); } catch (Exception e) { _logger.LogError("Delete Category Failed " + e); return(BadRequest(e.Message)); } }