Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(short id)
        {
            tempUser tempUser = db.tempUsers.Find(id);

            db.tempUsers.Remove(tempUser);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "UserID,UserName,UserPassword,UserTransactionPassword,RoleID")] tempUser tempUser)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tempUser).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tempUser));
 }
Exemplo n.º 3
0
        public ActionResult Create([Bind(Include = "UserID,UserName,UserPassword,UserTransactionPassword,RoleID")] tempUser tempUser)
        {
            if (ModelState.IsValid)
            {
                db.tempUsers.Add(tempUser);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tempUser));
        }
Exemplo n.º 4
0
        // GET: tempUsers/Delete/5
        public ActionResult Delete(short?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tempUser tempUser = db.tempUsers.Find(id);

            if (tempUser == null)
            {
                return(HttpNotFound());
            }
            return(View(tempUser));
        }
        public LogginViewModel(INavigation Navigation)
        {
            user = new User();

            quenmatkhau = new Command(async() =>
            {
                await App.Current.MainPage.Navigation.PushModalAsync(new ForgotPass());
            });
            checkloggin = new Command(async() =>
            {
                Isloading = true;
                Session sessioncurrent = App.Database.GetSession(1);
                List <User> listuser   = (List <User>)App.Database.GetUsers();
                tempUser tempuser      = new tempUser();

                string dataLogin = @"{
                    ""username"":""" + user.UserName + @""",
                    ""password"":""" + user.PassWord + @"""
                    }";
                string dataUser  = await api.Post("/user/login", dataLogin);

                tempuser = JsonConvert.DeserializeObject <tempUser>(dataUser);

                if (sessioncurrent is null && listuser is null || sessioncurrent is null && listuser != null || sessioncurrent != null && listuser is null)
                {
                    App.Database.DeleteAllSessions();

                    user.UserID = tempuser.id;
                    //user.UserName = "******";
                    //user.PassWord = "";
                    user.BirthDay    = Convert.ToDateTime(tempuser.birthday);
                    user.PhoneNumber = tempuser.phone_number;
                    user.Email       = tempuser.email;
                    user.Sex         = "";
                    user.IconUrl     = "";

                    session.UserID = tempuser.id;
                    session.State  = true;


                    App.Database.SaveUser(user);
                    App.Database.SaveSession(session);
                }
Exemplo n.º 6
0
 public MainWindowViewModel()
 {
     t1 = new tempUser("Kristian");
 }