public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     var userEmail = context.Request.Params["email"];
     var userPassword = context.Request.Params["password"];
     try
     {
         using (var dbContext = new EntityModel())
         {
             User user = dbContext.Set<User>().Where(u => u.Email == userEmail).FirstOrDefault();
             if (user == null)
             {
                 dbContext.Set<User>().Add(new User()
                 {
                     Email = userEmail,
                     Password = Crypto.HashPassword(userPassword)
                 });
                 dbContext.SaveChanges();
                 context.Response.StatusCode=200;
             }
             else context.Response.StatusCode=400;
         }
     }
     catch (Exception e)
     {
         context.Response.StatusCode = 400;
     }
 }
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     var userEmail = context.Request.Params["email"];
     var userPassword = context.Request.Params["password"];
     using (var dbContext = new EntityModel())
     {
         User user = dbContext.Set<User>().Where(u => u.Email == userEmail).FirstOrDefault();
         if (user != null && Crypto.VerifyHashedPassword(user.Password, userPassword))
         {
             UserAuthService.Authentificate(userEmail);
             context.Response.StatusCode = 200;
         }
         else context.Response.StatusCode=400;
     }
 }