public Manufacturer Post(ManufacturerDTO value) { Manufacturer manufacturer = new Manufacturer() { Name = value.Name, Location = value.Location }; return(IManufacturerRepo.Create(manufacturer)); }
public UnitOfWork(DbContext context) { this.Context = context; product = new ProductRepo(context); type = new TypeRepo(context); typeopt = new TypeOptRepo(context); typespec = new TypeSpecRepo(context); manufacturer = new ManufacturerRepo(context); }
public Manufacturer Delete(int id) { Manufacturer manufacturer = IManufacturerRepo.Get(id); foreach (Component component in IComponentRepo.GetAll()) { if (component.ManufacturerId == id) { IComponentRepo.Delete(component); } } return(IManufacturerRepo.Delete(manufacturer)); }
public void Put(int id, ManufacturerDTO value) { Manufacturer manufacturer = IManufacturerRepo.Get(id); if (value.Name != null) { manufacturer.Name = value.Name; } if (value.Location != null) { manufacturer.Location = value.Location; } IManufacturerRepo.Update(manufacturer); }
public ManufacturerDetailsDTO Get(int id) { Manufacturer manufacturer = IManufacturerRepo.Get(id); ManufacturerDetailsDTO manufacturerDetails = new ManufacturerDetailsDTO() { Name = manufacturer.Name, Location = manufacturer.Location }; IEnumerable <Component> components = IComponentRepo.GetAll().Where(x => x.ManufacturerId == manufacturer.Id); if (components != null) { List <string> componentsName = new List <string>(); foreach (Component component in components) { componentsName.Add(component.Name); } manufacturerDetails.Components = componentsName; } return(manufacturerDetails); }
public ManufacturersController(IManufacturerRepo repository, IMapper mapper) { _repository = repository; _mapper = mapper; }
public ActionResult <IEnumerable <Manufacturer> > Get() { return(IManufacturerRepo.GetAll()); }
public HomeController(IManufacturerRepo manufacturer) { _manufacturer = manufacturer; }