Beispiel #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            UserInfors userInfors = db.UserInfors.Find(id);

            db.UserInfors.Remove(userInfors);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
 public ActionResult Edit([Bind(Include = "ID,UserName,Password,Age,Email")] UserInfors userInfors)
 {
     if (ModelState.IsValid)
     {
         db.Entry(userInfors).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(userInfors));
 }
Beispiel #3
0
        public ActionResult Create([Bind(Include = "ID,UserName,Password,Age,Email")] UserInfors userInfors)
        {
            if (ModelState.IsValid)
            {
                db.UserInfors.Add(userInfors);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(userInfors));
        }
Beispiel #4
0
        private void OnAsyns()
        {
            //new Thread(new ThreadStart(() =>
            //{

            //})).Start();

            // get event add new message, change title, change avatar
            Service.Client.OnAsync(
                path: "Conversations/" + Model.Key + "/ChangedTime",
                changed: (sender, args, context) =>
            {
                if (DateTime.Parse(args.Data) > this.LoadedTime)
                {
                    this.Dispatcher.Invoke(() =>
                    {
                        LoadChange(ConversationService.GetConversationById(Model.Key));
                    });
                }
            }
                );


            // get event user is entering
            Service.Client.OnAsync(
                path: "Conversations/" + Model.Key + "/Members",
                changed: (sender, args, context) =>
            {
                var users = ConversationService.GetUsersEnteringOfConversation(Model.Key);
                UserEnteringContainer.Dispatcher.Invoke(() =>
                {
                    if (users.Count > 0)
                    {
                        UserEnteringContainer.Children.Clear();
                        foreach (var user in users)
                        {
                            UserModel model = null;
                            UserInfors.TryGetValue(user.Key, out model);
                            UserEnteringContainer.Children.Add(new ConversationUserEnteringControl(model));
                        }

                        UserEnteringWrapper.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        UserEnteringWrapper.Visibility = Visibility.Collapsed;
                    }
                });
            }
                );
        }
Beispiel #5
0
        // GET: UserInfors/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            UserInfors userInfors = db.UserInfors.Find(id);

            if (userInfors == null)
            {
                return(HttpNotFound());
            }
            return(View(userInfors));
        }