Beispiel #1
0
        public PartialViewResult UserOptions(UserOption model)
        {
            UserProfile user = _db.Users.Include("option").SingleOrDefault(u => u.UserName == User.Identity.Name);

            if (user.option == null)
            {
                user.option = model;
            }
            else
            {
                user.option.sendNoticeForNewReply     = model.sendNoticeForNewReply;
                user.option.sendNoticeForNewPostReply = model.sendNoticeForNewPostReply;
                user.option.addFavFlameEffect         = model.addFavFlameEffect;
                _blogUtil.CacheUserOption(user.option, user.UserName);
            }
            _db.SaveChanges();
            ViewBag.Success = true;
            return(PartialView(model));
        }