Пример #1
0
 public void TestSavePanic()
 {
     User u = User.GenerateNewUser();
     Panic p = new Panic("testCourse", u);
     Panic p2 = new Panic("testCourse", u);
     using (var db = new TestSurveyContext())
     {
         db.SaveUser(u);
         db.SavePanic(p);
         db.SavePanic(p2);
         db.SaveChanges();
     }
 }
Пример #2
0
		protected async Task PanicExecute ()
		{
			try {
				IsBusy = true;
				Panic panic = new Panic (cid, BackendAuthManager.Instance.User);
				await api.Backend.SavePanicAsync (panic);
				Status = "Sent Panic";
				IsBusy = false;
			} catch (Exception ex) {
				Status = "Failed: " + ex.Message;                
			}
		}
Пример #3
0
 public void DeletePanic(Panic panic)
 {
     this.Panics.Attach(panic);
     this.Panics.Remove(panic);
     this.SaveChanges();
 }
Пример #4
0
 public void SavePanic(Panic panic)
 {
     this.SaveUser(panic.User);
     if (panic.Id == 0)
     {
         this.Panics.Add(panic);
     }
     else
     {
         this.Panics.Attach(panic);
     }
     this.SaveChanges();
 }
Пример #5
0
 public string SavePanic(Panic panic)
 {
     try
     {
         if (panic == null)
         {
             throw new ArgumentNullException();
         }
         using (var db = new SurveyContext())
         {
             db.SavePanic(panic);
         }
         return "0";
     }
     catch (Exception e)
     {
         return e.Message;
     }
 }