public async Task <SubCategoryDTO> GetByIdAsync(Guid id) { Data.Entities.SubCategory subCategory = await _context.FindAsync <Data.Entities.SubCategory>(id); if (subCategory is null || subCategory.DeletedDate != null) { return(new SubCategoryDTO()); } return(CloneSubCategoryEntity(subCategory)); }
public SubCategoryDTO CloneSubCategoryEntity(Data.Entities.SubCategory subCategory) { SubCategoryDTO subCategoryDTO = new SubCategoryDTO { Id = subCategory.Id, CategoryId = subCategory.CategoryId, Name = subCategory.Name, Description = subCategory.Description, CreatedDate = subCategory.CreatedDate, CreatedBy = subCategory.CreatedBy, UpdatedDate = subCategory.UpdatedDate, UpdatedBy = subCategory.UpdatedBy, DeletedDate = subCategory.DeletedDate, DeletedBy = subCategory.DeletedBy, }; return(subCategoryDTO); }