Exemple #1
0
        public ActionResult <IEnumerable <Project> > GetProject()
        {
            var query = from project in _context.Set <Project>()
                        select project;

            return(query.OrderBy(q => q.StartTime).ToList());
        }
Exemple #2
0
        public ActionResult <IEnumerable <Object> > GetUsergroups(string account)
        {
            var usr = _context.Users.Find(account);

            if (usr == null)
            {
                return(NotFound());
            }

            var result1 =
                from member in _context.Set <Member>()
                from usergroup in _context.Set <Usergroups>()
                where member.GroupId == usergroup.GroupId && member.Account == account
                select new
            {
                usergroup.GroupId,
                usergroup.ProjectId,
                usergroup.LeaderAccount,
                usergroup.Name,
                usergroup.Introduction,
            };
            var result2 =
                from usergroup in _context.Set <Usergroups>()
                where usergroup.LeaderAccount == account
                select new
            {
                usergroup.GroupId,
                usergroup.ProjectId,
                usergroup.LeaderAccount,
                usergroup.Name,
                usergroup.Introduction,
            };

            return(result1.ToList().Union(result2.ToList()).ToList());
        }
Exemple #3
0
        public ActionResult <IEnumerable <Object> > GetMessage(string Account)
        {
            var user = _context.Users.Find(Account);

            if (user == null)
            {
                return(NotFound());
            }

            var result =
                from msg in _context.Set <Message>()
                join usr in _context.Set <Users>()
                on msg.ReceiveAccount equals user.Account
                where usr.Account == Account
                select new
            {
                msg.MessageId,
                msg.SendAccount,
                msg.Content,
                msg.Time,
                usr.Nickname
            };

            return(result.ToList());
        }
Exemple #4
0
        public ActionResult <IEnumerable <Object> > GetSubscribe()
        {
            var query = from subscribe in _context.Set <Subscribe>()
                        join project in _context.Set <Project>()
                        on subscribe.ProjectId equals project.ProjectId
                        select new { project.ProjectId, project.Name };

            return(query.ToList());
        }
Exemple #5
0
        public ActionResult <IEnumerable <Discussion> > GetDiscussion(int projectId)
        {
            var query = from project in _context.Set <Project>()
                        join discusson in _context.Set <Discussion>()
                        on project.ProjectId equals discusson.ProjectId
                        where project.ProjectId == projectId
                        select discusson;

            return(query.ToList());
        }
Exemple #6
0
        public ActionResult <IEnumerable <Object> > GetMomentStar(string account, string name)
        {
            var query = from momentStar in _context.Set <MomentStar>()
                        join moment in _context.Set <Moment>()
                        on momentStar.MomentId equals moment.MomentId
                        where momentStar.Account == account && momentStar.Name == name
                        select new { moment.MomentId, moment.Title };

            return(query.ToList());
        }
Exemple #7
0
        public ActionResult <IEnumerable <Object> > GetPostStar(string account, string name)
        {
            var query = from postStar in _context.Set <PostStar>()
                        join post in _context.Set <Post>()
                        on new { postStar.ProjectId, postStar.GroupId, postStar.PostId }
            equals new { post.ProjectId, post.GroupId, post.PostId }
            where postStar.Account == account && postStar.Name == name
            select new { post.ProjectId, post.GroupId, post.PostId, post.Content };

            return(query.ToList());
        }
Exemple #8
0
        public ActionResult <IEnumerable <Object> > GetComment(string momentId)
        {
            var query = from comment in _context.Set <Comment>()
                        join user in _context.Set <Users>()
                        on comment.Account equals user.Account
                        select new {
                comment.CommentId, comment.Account,
                comment.Content, comment.Time, user.Nickname,
                Icon = ALiYunOss.GetImageFromPath(user.Icon)
            };

            return(query.ToList());
        }
Exemple #9
0
        public ActionResult <IEnumerable <Object> > GetReply(int commentId)
        {
            var query = from reply in _context.Set <Reply>()
                        join user in _context.Set <Users>()
                        on reply.Account equals user.Account
                        where reply.CommentId == commentId
                        select new {
                reply.Account, reply.ReplyId,
                reply.Time, reply.Content, user.Nickname,
                Icon = ALiYunOss.GetImageFromPath(user.Icon)
            };

            return(query.ToList());
        }
Exemple #10
0
        public ActionResult <IEnumerable <Object> > GetApplication(string account)
        {
            var result =
                from application in _context.Set <Application>()
                from usergroup in _context.Set <Usergroups>()
                from user in _context.Set <Users>()
                where application.GroupId == usergroup.GroupId && usergroup.LeaderAccount == account
                select new{
                usergroup.ProjectId, usergroup.GroupId, usergroup.Name,
                application.Account, userName = user.Name, application.Content, application.Status
            };

            return(result.ToList());
        }
        public ActionResult <IEnumerable <Object> > GetNotification(string account)
        {
            var query = from subscribe in _context.Set <Subscribe>()
                        join project in _context.Set <Project>()
                        on subscribe.ProjectId equals project.ProjectId
                        into sub_proj
                        from sp in sub_proj
                        join notifi in _context.Set <Notification>()
                        on sp.ProjectId equals notifi.ProjectId
                        where subscribe.Account == account
                        select new { sp.Name, notifi.Title, notifi.Content, notifi.Time };

            return(query.ToList());
        }
Exemple #12
0
        public ActionResult <IEnumerable <Object> > GetFavouritePackage(string account)
        {
            var query = from favpack in _context.Set <FavouritePackage>()
                        where favpack.Account == account
                        select new { favpack.Name, favpack.CreateTime, favpack.Type };

            return(query.ToList());
        }
Exemple #13
0
        public ActionResult <IEnumerable <Object> > GetPost(int projectId)
        {
            var query = from post in _context.Set <Post>()
                        join usergroup in _context.Set <Usergroups>()
                        on new { post.GroupId, post.ProjectId } equals
            new { usergroup.GroupId, usergroup.ProjectId } into groupPost
            from gp in groupPost
            join user in _context.Set <Users>()
            on gp.LeaderAccount equals user.Account
            where post.ProjectId == projectId
            select new {
                post.PostId, post.GroupId, post.PostTime,
                gp.LeaderAccount, user.Nickname, icon = ALiYunOss.GetImageFromPath(user.Icon)
            };

            return(query.ToList());
        }
Exemple #14
0
        public ActionResult <IEnumerable <Object> > GetUsrMoment(string account)
        {
            var query = from moment in _context.Set <Moment>()
                        where moment.Account == account
                        select new { moment.MomentId, moment.Title };

            return(query.ToList());
        }
Exemple #15
0
        public ActionResult <IEnumerable <Object> > GetUsers(string name)
        {
            var query = from user in _context.Set <Users>()
                        where user.Name == name
                        select new {
                icon = ALiYunOss.GetImageFromPath(user.Icon),
                user.Account, user.Nickname
            };

            return(query.ToList());
        }
Exemple #16
0
        public ActionResult <IEnumerable <Object> > GetGroupMessage(string account)
        {
            Users user  = _context.Users.Find(account);
            var   query = from userGroupMessage in _context.Set <UserGroupMessage>()
                          join groupMessage in _context.Set <GroupMessage>()
                          on userGroupMessage.GroupMessageId equals groupMessage.GroupMessageId into UsrGpMs
                          from usrGpMs in UsrGpMs
                          join userGroup in _context.Set <Usergroups>()
                          on usrGpMs.GroupId equals userGroup.GroupId into UGMG
                          from ugmg in UGMG
                          join project in _context.Set <Project>()
                          on ugmg.ProjectId equals project.ProjectId
                          where userGroupMessage.Account == account
                          select new {
                usrGpMs.GroupMessageId, usrGpMs.GroupId, usrGpMs.ProjectId, usrGpMs.Time, usrGpMs.Content,
                GroupName = ugmg.Name, ProjectName = project.Name
            };

            return(query.ToList());
        }
Exemple #17
0
        public ActionResult <IEnumerable <Report> > GetReport(int id)
        {
            var query = from report in _context.Set <Report>()
                        where
                        report.ReportId == id
                        select report;

            if (query == null)
            {
                return(NotFound());
            }

            return(query.ToList());
        }
Exemple #18
0
        public ActionResult <IEnumerable <MomentItem> > GetMoment()
        {
            var query = from mom in _context.Set <Moment>()
                        from user in _context.Set <Users>()
                        where mom.Account == user.Account
                        select new MomentItem {
                moment    = mom, icon = ALiYunOss.GetImageFromPath(user.Icon), nickname = user.Nickname,
                likeCount = (from like in _context.Set <LikeMoment>()
                             where like.Account == mom.Account
                             select like.Account).Count(),
                commentCount = (from comment in _context.Set <Comment>()
                                where comment.Account == mom.Account
                                select comment.Account).Count(),
                starCount = (from star in _context.Set <MomentStar>()
                             where star.Account == mom.Account
                             select star.Account).Count()
            };

            return(query.ToList());
        }