public void AddUpdate(Update update) { var updates = GetOs("Windows 7").Updates ?? new List<Update>(); if (updates.FirstOrDefault(x => x.KBNumber == update.KBNumber) == null) updates.Add(update); SaveChanges(); }
public void AddUpdate(Update update) { var updates = GetOs("Windows 98SE").Updates ?? new List<Update>(); var update2 = updates.FirstOrDefault(x => x.KBNumber == update.KBNumber); if (update2 == null || (update2 != null && update.Is32Bit != update2.Is32Bit) ) updates.Add(update); SaveChanges(); }
public ActionResult Updates(Update update, List<string> SelectedOSs) { var list = _repo.GetOsList(); var osList = new List<OS>(); foreach (var os in list) { if(SelectedOSs.Contains(os.Name)) osList.Add(os); } //update.OperatingSystems = osList; foreach (var os in osList) { if(os.Updates == null) os.Updates = new List<Update>(); os.Updates.Add(update); } _repo.SaveChanges(); return View(); }