public IncidentsPage(Incident incident)
        {
            InitializeComponent ();
            BindingContext = incident;

            saveButton.Clicked += async (sender, e) => await DisplayAlert ("Alert", "You updated an incident", "Ok");
        }
 public IncidentsEditDetailVM(Incident incident, IIncidentService svc)
 {
     Title = "Incident Information";
     service = svc;
     IsVisible = incident != null;
     Model = incident?? new Incident();
 }
 public virtual void UpdateIncident(Incident incident)
 {
     var itemToUpdate = _incidents.Where (i => i.ID == incident.ID).Single ();
     itemToUpdate.Location = incident.Location;
     itemToUpdate.Status = incident.Status;
     itemToUpdate.Title = incident.Title;
 }
 public void UpdateIncident(Incident incident)
 {
     using(var conn = localdb.GetConnection ()) {
         if(incident.ID == 0) {
             incident.Status = "Open";
             incident.DateOccurred = DateTime.Now;
             conn.Insert (incident);
         }
         else
             conn.Update (incident);
     }
 }
 public virtual void ResetModel()
 {
     Model = new Incident();
 }
 public IncidentsEditDetailVM(Incident incident)
     : this(incident, new SQLiteIncidentService())
 {
 }
 public virtual void RemoveIncident(Incident incident)
 {
     var itemToRemove = _incidents.Where (i => i.ID == incident.ID).Single ();
     _incidents.Remove (itemToRemove);
 }
 public virtual void CreateIncident(Incident incident)
 {
     incident.ID = _incidents.Count;
     _incidents.Add (incident);
 }
 public void RemoveIncident(Incident incident)
 {
     using(var conn = localdb.GetConnection ()) {
         conn.Delete<Incident> (incident);
     }
 }
 public void CreateIncident(Incident incident)
 {
     using(var conn = localdb.GetConnection ()) {
         conn.Insert (incident);
     }
 }