public static void SortInmates() { var inmates = Inmates.ToList(); inmates.Sort(new InmateComparer()); Inmates.Clear(); foreach (var inmate in inmates) { Inmates.Add(inmate); } }
public static void MapInmateToViewModel(Inmate inmate) { // shop obj needed to get the shop index for the drop down menu var shop = Shops.SingleOrDefault(s => s.Id == inmate.ShopId); Inmates.Add(new InmateViewModel { Id = inmate.Id, FirstName = inmate.FirstName, LastName = inmate.LastName, GDCNumber = inmate.GDCNumber, ShopId = inmate.ShopId, ShopIndex = Shops.IndexOf(shop) }); }
public void Punish(Inmate inmate) { lock (Lock) { var utxo = inmate.Utxo; // If successfully removed, then it contained it previously, so make the punishment banned and restart its time. Inmate inmateToPunish = inmate; if (Inmates.Remove(utxo)) { // If it was noted before, then no matter the specified punishment, it must be banned. // Both the started and the last disrupted round parameters must be updated. inmateToPunish = new Inmate(utxo, Punishment.Banned, inmate.Started, inmate.LastDisruptedRoundId); } Inmates.Add(utxo, inmateToPunish); ChangeId = Guid.NewGuid(); } }