public static internalDTO.ProductClassification MapFromExternal(externalDTO.ProductClassification productClassification) { var res = productClassification == null ? null : new internalDTO.ProductClassification() { Id = productClassification.Id, ProductClassificationValue = productClassification.ProductClassificationValue }; return(res); }
public async Task <IActionResult> PutProductClassification(int id, v1_0_DTO.ProductClassification productClassification) { if (id != productClassification.Id) { return(BadRequest()); } _bll.ProductClassifications .Update(v1_0_Mapper.ProductClassificationMapper .MapFromExternal(productClassification)); await _bll.SaveChangesAsync(); return(NoContent()); }
public async Task <ActionResult <v1_0_DTO.ProductClassification> > PostProductClassification(v1_0_DTO.ProductClassification productClassification) { productClassification = v1_0_Mapper.ProductClassificationMapper.MapFromBLL( await _bll.ProductClassifications .AddAsync(v1_0_Mapper.ProductClassificationMapper.MapFromExternal(productClassification))); await _bll.SaveChangesAsync(); productClassification = v1_0_Mapper.ProductClassificationMapper.MapFromBLL( _bll.ProductClassifications.GetUpdatesAfterUOWSaveChanges( v1_0_Mapper.ProductClassificationMapper.MapFromExternal(productClassification))); return(CreatedAtAction("GetProductClassification", new { version = HttpContext.GetRequestedApiVersion().ToString(), id = productClassification.Id }, productClassification)); }