private List <Equipment> getNewEquipmentFromAdvToAdd(AdvertismentToAdd advertismentToAdd) { List <Equipment> eqs = new List <Equipment>(); List <Equipment> equipments = equipmentsRepository.Get().ToList(); foreach (var item in advertismentToAdd.Equipments) { if (equipments.Find(x => x.EquipmentName.Equals(item.Name)) == null) { eqs.Add(new Equipment() { EquipmentName = item.Name }); } } return(eqs); }
private List <EquipmentVM> MakeEquipmentList(List <EquipmentObjectToRent> equipmentsObjectToRent) { List <EquipmentVM> eqs = new List <EquipmentVM>(); List <Equipment> equipments = equipmentsRepository.Get().ToList(); foreach (var item in equipmentsObjectToRent) { eqs.Add(new EquipmentVM() { Name = equipments.Find(x => x.EquipmentId == item.EquipmentId).EquipmentName, Description = item.EquipmentDescription }); } return(eqs); }