Exemple #1
0
 public static GetMaturityCategoryResponseModel FromBusinessModel(MaturityCategory maturityCategory)
 {
     return(new GetMaturityCategoryResponseModel
     {
         Id = maturityCategory.Id,
         Name = maturityCategory.Name,
         CreatedAt = maturityCategory.CreatedAt,
         UpdatedAt = maturityCategory.UpdatedAt
     });
 }
        public async Task <MaturityCategory> ExecuteAsync(GetMaturityCategoryQueryRequestModel queryRequest)
        {
            var maturityCategory = await this.maturityCategoriesRepository.GetAsync(queryRequest.Id);

            if (maturityCategory == null)
            {
                throw new HttpException(HttpStatusCode.NotFound, $"MaturityCategory (ID: {queryRequest.Id}) cannot be found.");
            }

            return(MaturityCategory.FromTableRecord(maturityCategory));
        }
        public async Task <Guid> ExecuteAsync(CreateMaturityCategoryCommandRequestModel commandRequest)
        {
            var maturityCategory = new MaturityCategory
            {
                Id   = Guid.NewGuid(),
                Name = commandRequest.Name
            };

            await this.maturityCategoriesRepository.CreateAsync(maturityCategory.ToTableRecord());

            return(maturityCategory.Id);
        }
        public async Task <IEnumerable <MaturityCategory> > ExecuteAsync()
        {
            var maturityCategories = await this.maturityCategoriesRepository.GetAllAsync();

            var maturityCategoryList = new List <MaturityCategory>();

            foreach (var maturityCategory in maturityCategories)
            {
                maturityCategoryList.Add(MaturityCategory.FromTableRecord(maturityCategory));
            }

            return(maturityCategoryList);
        }