public async Task <IHttpActionResult> GetById(int id) { ProductAttributeMappingDTO ProductAttributeMapping = await ProductAttributeMappingService.GetAll().Where(x => x.Id == id).ProjectTo <ProductAttributeMappingDTO>().FirstOrDefaultAsync(); if (ProductAttributeMapping == null) { return(NotFound()); } return(Ok(ProductAttributeMapping)); }
public async Task <IHttpActionResult> Update([FromBody] ProductAttributeMappingDTO ProductAttributeMappingDto) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var entity = await ProductAttributeMappingService.FindOneAsync(ProductAttributeMappingDto.Id); entity = ProductAttributeMappingDto.ToEntity(entity); await ProductAttributeMappingService.UpdateAsync(entity); return(Ok(entity.ToModel())); }
public static ProductAttributeMapping ToEntity(this ProductAttributeMappingDTO dto, ProductAttributeMapping entity) { return(Mapper.Map(dto, entity)); }
public static ProductAttributeMapping ToEntity(this ProductAttributeMappingDTO dto) { return(Mapper.Map <ProductAttributeMappingDTO, ProductAttributeMapping>(dto)); }