Ejemplo n.º 1
0
        public ActionResult ProjectList()
        {
            var result  = _postservice.GetAll();
            var result3 = _postservice.GetAll();
            //var a = result.Where(d => d.Flag == 0);

            var result2 = _skillservice.GetAll();
            ProjectListModel projectListModel = new ProjectListModel();

            if (result != null)
            {
                foreach (var p in result.Data)
                {
                    var select = _selectedWorkerService.GetAll().Data.Where(d => d.PostId == p.PostId).ToList();
                    if (select.Count == p.Members)
                    {
                        result3.Data.Remove(p);
                    }
                }
            }

            result = result3;
            projectListModel.PostAProjects = result.Data.OrderByDescending(m => m.PostId).ToList();
            projectListModel.Skills        = result2.Data;

            return(View(projectListModel));
        }
        public ActionResult RequestedMember(int id)
        {
            RequestedMemberModel requested = new RequestedMemberModel();
            //postid
            var result = _responseservice.GetAll(id + "");

            var result2 = _postservice.GetByID(id);
            var select  = _selectedWorkerService.GetAll().Data.Where(d => d.PostId == id).ToList();


            requested.ProjectName = result2.Data.ProjectName;
            requested.Description = result2.Data.Description;
            requested.PostId      = result2.Data.PostId;
            var m = result.Data.Where(p => p.Flag == 0).ToList();

            if (select.Count < result2.Data.Members)
            {
                foreach (var user in m)
                {
                    var result3 = _userservice.GetByID(user.WUserId);
                    requested.UserInfo.Add(result3.Data);
                }
            }

            List <ProfileWorker> totList = new List <ProfileWorker>();

            foreach (var v in requested.UserInfo)
            {
                var proWorkVM = new ProfileWorker();
                var obj       = proWorkVM.creation(v, new WorkerInfo(),
                                                   _ratingWorkerService.GetAll().Data.Where(d => d.UserId == v.UserId).ToList(),
                                                   new List <PostAProject>());
                totList.Add(obj);
            }

            totList = totList.OrderByDescending(d => d.tot).ToList();
            var uInfo = new List <UserInfo>();

            foreach (var v in totList)
            {
                uInfo.Add(_userservice.GetByID(v.UserId).Data);
            }

            requested.UserInfo = uInfo;
            requested.totalAvg = totList;
            return(View(requested));
        }