Пример #1
0
 /// <summary>
 /// Maps id, name
 /// </summary>
 /// <param name="dto"></param>
 /// <returns></returns>
 /// <exception cref="NullReferenceException"></exception>
 public static BLLCategoryDTO FromDAL3(DALCategoryDTO dto)
 {
     if (dto == null)
     {
         throw new NullReferenceException("Can't map, DALCategoryDTO is null");
     }
     return(new BLLCategoryDTO()
     {
         CategoryId = dto.Id,
         CategoryName = dto.Name
     });
 }
Пример #2
0
 public static Category FromDAL(DALCategoryDTO dto)
 {
     if (dto == null)
     {
         throw new NullReferenceException("Can't map, category DTO is null");
     }
     return(new Category()
     {
         CategoryName = new MultiLangString(dto.Name),
         OrganizationId = dto.OrganizationId
     });
 }
Пример #3
0
 /// <summary>
 /// Maps Id, Name, OrganizationId, Products(name, id, orgId, price, description)
 /// </summary>
 /// <param name="dto"></param>
 /// <returns></returns>
 /// <exception cref="NullReferenceException"></exception>
 public static BLLCategoryDTO FromDAL2(DALCategoryDTO dto)
 {
     if (dto == null)
     {
         throw new NullReferenceException("Can't map, DALCategoryDTO is null");
     }
     return(new BLLCategoryDTO()
     {
         CategoryId = dto.Id,
         OrganizationId = dto.OrganizationId,
         CategoryName = dto.Name,
         Products = dto.Products
                    .Select(ProductMapper.FromDAL2)
                    .ToList()
     });
 }
Пример #4
0
        public async Task AddAsync(DALCategoryDTO categoryDTO)
        {
            var category = CategoryMapper.FromDAL(categoryDTO);

            await RepoDbSet.AddAsync(category);
        }