Example #1
0
        public Model.OperationStatus MarkItemAsRead(int itemId, int userId)
        {
            var opStatus = new OperationStatus()
            {
                Status = true
            };

            using (var context = DataContext)
            {
                var item = new Model.UserItem()
                {
                    ItemId = itemId, UserId = userId, ReadOn = DateTime.Now
                };
                context.UserItems.Add(item);
                opStatus.RecordsAffected = context.SaveChanges();
            }
            return(opStatus);
        }
Example #2
0
        public Model.OperationStatus MarkFeedAsRead(int feedId, int userId)
        {
            var opStatus = new OperationStatus()
            {
                Status = true
            };

            using (var context = DataContext)
            {
                var items = GetUnreadItems(feedId, userId);
                foreach (var unread in items)
                {
                    var item = new Model.UserItem()
                    {
                        ItemId = unread.Id, UserId = userId, ReadOn = DateTime.Now
                    };
                    context.UserItems.Add(item);
                }
                opStatus.RecordsAffected = context.SaveChanges();
            }
            return(opStatus);
        }
Example #3
0
        /// <summary>
        /// 获取用户登录信息
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public static Model.UserItem UserLogOn(Model.UserItem userInfo)
        {
            var getUser = Funs.DB.View_Sys_User.FirstOrDefault(x => (x.Account == userInfo.Account || x.Telephone == userInfo.Telephone) && x.IsPost == true && x.Password == Funs.EncryptionPassword(userInfo.Password));

            return(ObjectMapperManager.DefaultInstance.GetMapper <Model.View_Sys_User, Model.UserItem>().Map(getUser));
        }