public ComputerTechnology(ComputerTechnologyModel computerTechnologyModel)
 {
     Name           = computerTechnologyModel.Name;
     Price          = computerTechnologyModel.Price;
     IsAvailable    = computerTechnologyModel.IsAvailable;
     Description    = computerTechnologyModel.Description;
     ProducerId     = computerTechnologyModel.ProducerId;
     ManufacturerId = computerTechnologyModel.ManufacturerId;
     MaterialValue  = computerTechnologyModel.Material;
     ColorValue     = computerTechnologyModel.Color;
     if (computerTechnologyModel.UserId != null && computerTechnologyModel.UserId != new Guid())
     {
         UserId = computerTechnologyModel.UserId;
     }
 }
        public async Task <int> AddComputerTechnology(ComputerTechnologyModel computerTechnologyModel, string email)
        {
            try
            {
                computerTechnologyModel.UserId = (await _context.Users.FirstOrDefaultAsync(user => user.Email == email)).Id;
                var computerTechnology = new ComputerTechnology(computerTechnologyModel);
                await AddGoodData(computerTechnologyModel.ImageIds, computerTechnology);

                await _context.Goods.AddAsync(computerTechnology);

                await _context.SaveChangesAsync();

                return(1);
            }
            catch (Exception)
            {
                throw;
            }
        }
 public async Task <int> AddComputerTechnology([FromBody] ComputerTechnologyModel computerTechnologyModel)
 {
     return(await _goodsCreator.AddComputerTechnology(computerTechnologyModel, User.Identity.Name));
 }