Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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);
        }