public Component Put(int id, ComponentDTO value) { Component model = IComponentRepository.Get(id); if (value.ManufacturerId != 0) { model.ManufacturerId = value.ManufacturerId; } if (value.Quantity != 0) { model.Quantity = value.Quantity; } if (value.Name != null) { model.Name = value.Name; } if (Math.Abs(value.Price - 0.0000) < 0.0001) { model.Price = value.Price; } if (value.Quantity != -1) { model.Quantity = value.Quantity; } if (value.Status != null) { model.Status = value.Status; } if (value.Image != null) { model.Image = value.Image; } return(IComponentRepository.Update(model)); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var component = _repository.Get(id); if (component == null) { return(HttpNotFound()); } if (!Request.IsAjaxRequest()) { return(RedirectToAction("Index")); } _repository.Delete(component); _repository.Save(); return(Json("", JsonRequestBehavior.AllowGet)); }
public Component Delete(int id) { IEnumerable <TeamComponent> MyTeamComponents = ITeamComponentRepository.GetAll().Where(x => x.Id == id); foreach (TeamComponent MyTeamComponent in MyTeamComponents) { ITeamComponentRepository.Delete(MyTeamComponent); } Component component = IComponentRepository.Get(id); return(IComponentRepository.Delete(component)); }
public List <Component> FindComponents(List <int> ids) { if (ids != null && ids.Count != 0) { var result = new List <Component>(); for (var i = 0; i < ids.Count; ++i) { result.Add(_componentRepository.Get(ids[i])); } return(result); } return(null); }
public async Task <ActionResult <Component> > Get([FromRoute] int?id) { if (id == null) { return(NotFound("Bad parameter")); } var component = await _repository.Get(id); if (component == null) { return(NotFound()); } return(component); }
public ComponentDetailsDTO Get(int id) { Component component = IComponentRepository.Get(id); ComponentDetailsDTO myComponent = new ComponentDetailsDTO() { Name = component.Name, Price = component.Price, Quantity = component.Quantity }; Provider provider = IProviderRepository.Get(component.ProviderId); myComponent.ProviderName = provider.Name; return(myComponent); }
public Component Put(int id, ComponentDTO value) { Component model = IComponentRepository.Get(id); if (value.Name != null) { model.Name = value.Name; } if (value.Price != 0) { model.Price = value.Price; } model.Quantity = value.Quantity; if (value.ProviderId != 0) { model.ProviderId = value.ProviderId; } return(IComponentRepository.Update(model)); }
public ActionResult <Component> Get(int id) { return(IComponentRepository.Get(id)); }
public Component Get(int id, string tokenLogin) { return(componentRepository.Get(id)); }
public Component Get(int id) { return(componentRepository.Get(id)); }
public Component Delete(int id) { Component component = IComponentRepository.Get(id); return(IComponentRepository.Delete(component)); }