public async Task <JsonResult> AddFileCategory(FileCategory fileCategory) { if (String.IsNullOrEmpty(fileCategory.Name)) { return(new JsonResult(new { result = false })); } try { if (fileCategory.ParentId == 0) { fileCategory.ParentId = null; } if (fileCategory.Id != 0) { await _fileCategoryService.Update(fileCategory); } else { await _fileCategoryService.Create(fileCategory); } return(new JsonResult(new { result = true })); } catch (System.Exception ex) { throw new Exception(ex.Message); } }