public IActionResult Add(int plasticBagTypeId, [FromBody] StandardSizeDto standardSizeDto) { var standardSize = _standardSizeAppService.Add(plasticBagTypeId, standardSizeDto); if (standardSize == null) { return(NotFound()); } return(StatusCode(StatusCodes.Status201Created, standardSize)); }
public StandardSizeDto Add(int plasticBagTypeId, StandardSizeDto standardSizeDto) { var plasticBagType = GetPlasticBagTypeById(plasticBagTypeId); if (plasticBagType == null) { return(null); } var standardSize = _mapper.Map <StandardSize>(standardSizeDto); plasticBagType.AddStandardSize(standardSize); _unitOfWork.Complete(); return(_mapper.Map <StandardSizeDto>(standardSize)); }