Beispiel #1
0
 private Routine GetRoutine()
 {
     if (User?.Identity?.IsAuthenticated ?? true)
     {
         Routine routine = HttpContext.Session.GetJson <Routine>("Routine") ?? new Routine();
         routine.UserName = User.Identity.Name;           // save routines to a user's username??
         context_.Routines.Add(routine);
         context_.SaveChanges();
         return(routine);
     }
     else
     {
         Routine routine = HttpContext.Session.GetJson <Routine>("Routine") ?? new Routine();
         return(routine);
     }
 }
Beispiel #2
0
 public Task <bool> SaveAsync()
 {
     return(Task.FromResult(context.SaveChanges() > 0));
 }