public BriefManufacturerBM(ManufacturerIdBM manufacturerId, string name, ManufacturerLocationBM location, Uri websiteUri) { ManufacturerId = manufacturerId; Name = name; Location = location; WebsiteUri = websiteUri; }
public CreateProductRequestBM(BarcodeBM barcode, ManufacturerIdBM manufacturerId, CategoryIdBM categoryId, IReadOnlyDictionary <string, string> name) { Barcode = barcode ?? throw new ArgumentNullException(nameof(barcode)); ManufacturerId = manufacturerId; CategoryId = categoryId; Name = name ?? throw new ArgumentNullException(nameof(name)); }
public UpdateProductRequestBM(BarcodeBM barcode, ManufacturerIdBM newManufacturerId, CategoryIdBM newCategoryId, IReadOnlyDictionary <string, string> productName) { Barcode = barcode; NewManufacturerId = newManufacturerId; NewCategoryId = newCategoryId; ProductName = productName; }
public ManufacturerBM(ManufacturerIdBM manufacturerId, string name, ManufacturerLocationBM location, Uri websiteUri, ManufacturerLogoBM logo) : base(manufacturerId, name, location, websiteUri) { Logo = logo; }
public async Task <ResultBM <ManufacturerLogoBM, GetManufacturerLogoExplanation> > GetLogoAsync(ManufacturerIdBM id) { ManufacturerLogoBM result; try { var data = await dbContext.Manufacturer.ProjectTo <PManufacturerCompanyLogo>(mapper.ConfigurationProvider).SingleAsync(x => x.Id == id.Value); if (data.CompanyLogo == null) { return(new FailureResultBM <ManufacturerLogoBM, GetManufacturerLogoExplanation>(GetManufacturerLogoExplanation.ManufacturerLogoNotExists)); } result = new ManufacturerLogoBM(data.CompanyLogo, data.CompanyLogoMimetype); } catch (InvalidOperationException) { return(new FailureResultBM <ManufacturerLogoBM, GetManufacturerLogoExplanation>(GetManufacturerLogoExplanation.ManufacturerNotExists)); } catch (Exception) { return(new FailureResultBM <ManufacturerLogoBM, GetManufacturerLogoExplanation>(GetManufacturerLogoExplanation.DatabaseError)); } return(new SuccessfulResultBM <ManufacturerLogoBM, GetManufacturerLogoExplanation>(result)); }
public async Task <ManufacturerBM> GetAsync(ManufacturerIdBM id) { return(mapper.Map <Manufacturer, ManufacturerBM>( await dbContext.Manufacturer.SingleAsync(x => x.Id == id.Value) )); }