示例#1
0
文件: DbHelper.cs 项目: macki/razem
        public void EditUser(UserModels newUser)
        {
            var user = GetUser(newUser.UserId);

            user.Name = newUser.Name;
            user.Gender = newUser.Gender;
            user.Email = newUser.Email;
            user.Experiance = newUser.Experiance;
            user.numberOfPosts = newUser.numberOfPosts;
            user.SignedDate = newUser.SignedDate;
            user.Validated = newUser.Validated;
            user.ValidationUrl = newUser.ValidationUrl;

            dbStore.Entry(user).State = System.Data.EntityState.Modified;
            dbStore.SaveChanges();
            dbStore = new RazemTaniejEntities();
        }
示例#2
0
文件: DbHelper.cs 项目: macki/razem
        public bool CheckIfUserRankedDealBefore(DealModels deal, UserModels user)
        {
            var query = from p in user.RankedDeals
                        where p == deal
                        select p;

            if (query.Count() == 0)
            {
                return false;
            }

            return true;
        }
示例#3
0
文件: DbHelper.cs 项目: macki/razem
        public void AddUser(RegisterModel model)
        {
            var user = new UserModels { Name = model.UserName,
                                        Email = model.Email,
                                        Comments = new List<CommentModels>(),
                                        Deals = new List<DealModels>(),
                                        Validated = false,
                                        ValidationUrl = Utils.ToolUtils.CreateValidationEmail(model.Email, "http://localhost:61382/")
            };

            dbStore.User.Add(user);
            dbStore.SaveChanges();
        }
示例#4
0
文件: DbHelper.cs 项目: macki/razem
        public void AddUser(int fbId, string userName, string email, string gender)
        {
            var user = new UserModels
            {
                Name = userName,
                Email = email,
                Comments = new List<CommentModels>(),
                Deals = new List<DealModels>(),
                RankedDeals = new List<DealModels>(),
                FacebookId = fbId,
                Gender = gender,
                Validated = false
            };

            dbStore.User.Add(user);
            dbStore.SaveChanges();
        }
示例#5
0
文件: DbHelper.cs 项目: macki/razem
 public void AddPositiveMark(DealModels deal, UserModels user)
 {
     deal.Rank = deal.Rank + 1;
     user.RankedDeals.Add(deal);
     dbStore.SaveChanges();
 }
示例#6
0
 public ActionResult EditUser(UserModels newUser)
 {
     dbHelper.EditUser(newUser);
     return RedirectToAction("ShowAllUserPanel");
 }