public async Task <string> GetDescriptionOfManufacturer(ManufacturerViewModelM manufacturerModel) { var manufacturer = _manufacturerFactoryCreation.FactoryCreate(manufacturerModel); var points = _reviewService.GetUsersReviewPoints(); var date = _dateService.GetDate(); await _manufacturerRepository.Add(new Manufacturer { Name = manufacturer.Name }); return(_descriptionConcatService.CreateDescription(manufacturer.Name, points, date)); }
public async Task <string> GetDescriptionOfManufacturer(ManufacturerViewModelM manufacturerModel) { var manufacturer = _manufacturerFactoryCreation.FactoryCreate(manufacturerModel); var points = _reviewService.GetUsersReviewPoints(); var date = _dateService.GetDate(); await _manufacturerRepository.Add(new Manufacturer { Name = manufacturer.Name }); return($"Description old: {manufacturer.Name} with points: {points}, published: {date}"); }
public IManufacturerM FactoryCreate(ManufacturerViewModelM manufacturerType) { if (manufacturerType.ManufacturerType.Equals("Expensive")) { return(new CheapManufacturerM()); } else if (manufacturerType.ManufacturerType.Equals("Cheap")) { return(new ExpensiveManufacturerM()); } else { throw new ArgumentException(); } }
public async Task <IHttpActionResult> GetNewestDescriptionOfManufacturer([FromBody] ManufacturerViewModelM manufacturerViewModel) => Ok(await _manufacturerFacadeService.GetDescriptionOfManufacturer(manufacturerViewModel));