public ParticipantViewModel(ApplicationViewModel app) { _app = app; _previousPage = _app.CurrentPageViewModel; _operation = "Create"; LoadParticipants(); _participant = new ParticipantModel(); _participant.ParticipantId = _allParticipants.Count == 0 ? 1 : _allParticipants.Last <ParticipantModel>().ParticipantId + 1; }
private ParticipantModel LoadParticipant(XmlNode node) { ParticipantModel p = new ParticipantModel(); p.ParticipantId = Int32.Parse(node.Attributes["Id"].Value); p.Name = node.Attributes["Name"].Value; p.Date = node.Attributes["Date"].Value; p.Altitude = node.Attributes["Altitude"].Value; p.Serie = Int32.Parse(node.Attributes["Serie"].Value); return(p); }
public ParticipantViewModel(ApplicationViewModel app, int id, bool isDelete) { _app = app; _participantId = id; _previousPage = _app.CurrentPageViewModel; if (isDelete) { _operation = "Delete"; _buttonText = "Confirm?"; } else { _operation = "Edit"; } LoadParticipants(); IEnumerable <ParticipantModel> p = _allParticipants.Where(x => x.ParticipantId == id); _participant = p.FirstOrDefault(); }