/// <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 }); }
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 }); }
/// <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() }); }
public async Task AddAsync(DALCategoryDTO categoryDTO) { var category = CategoryMapper.FromDAL(categoryDTO); await RepoDbSet.AddAsync(category); }