Exemplo n.º 1
0
        public async Task <IActionResult> AddDirectory(DirectoryDto dir, CancellationToken cancellationToken)
        {
            try
            {
                int result = await _dirService.AddDirectory(dir, cancellationToken).ConfigureAwait(false);

                if (result == 0)
                {
                    return(BadRequest("No data found!"));
                }
                else
                {
                    return(Ok("Category added successfully"));
                }
            }
            catch (Exception ex)
            {
                await _errorlogService.InsertError(Request.GetDisplayUrl(), ControllerContext.ActionDescriptor.ActionName.ToString(), ex.Message, ex.ToString()).ConfigureAwait(false);

                return(StatusCode(500, ex.InnerException));
            }
        }