Exemple #1
0
        public async Task <ActionResult <ComponentMinimal> > PostComponent(ComponentCreate component)
        {
            var bllEntity = _componentMapper.MapToBLL(component);

            _bll.Components.AddNoReturn(bllEntity);
            await _bll.SaveChangesAsync();

            return(CreatedAtAction("GetComponent", new { id = bllEntity.Id }, component));
        }
Exemple #2
0
 public ComponentMinimal MapToBLL(ComponentCreate apiComponent)
 {
     return(new ComponentMinimal
     {
         Id = 0,
         ComponentTypeId = apiComponent.ComponentTypeId,
         ManufacturerId = apiComponent.ManufacturerId,
         Model = apiComponent.Model,
         ReleaseYear = apiComponent.ReleaseYear,
         ComponentName = apiComponent.ComponentName,
         Price = apiComponent.Price
     });
 }