public ActionResult teamMemberView(int pid)
        {
            DatabaseEntities    db        = new DatabaseEntities();
            projectProgress2    data      = new projectProgress2();
            List <projectData>  pdata     = db.projectDatas.Where(r => r.projectID == pid).OrderByDescending(x => x.date).ToList();
            List <UserTable>    user      = db.teamMembersTables.Where(r => r.project_id == pid).Select(r => r.UserTable).ToList();
            List <GroupPost>    grp       = db.GroupPosts.Where(r => r.projectID == pid).ToList();
            List <groupMsgData> msgDetail = new List <groupMsgData>();

            foreach (var d in grp)
            {
                groupMsgData obj = new groupMsgData();
                obj.sender = db.UserTables.Find(d.userID);
                obj.msg    = d;
                msgDetail.Add(obj);
            }
            data.projectdata    = pdata;
            data.usesrData      = user;
            data.loginUser      = db.UserTables.Find((int)Session["UserID"]);
            data.projectID      = pid;
            data.tMTable        = db.teamMembersTables.Where(r => r.project_id == pid).ToList();
            data.messagesDetail = msgDetail;
            data.teamLead       = db.ProjectsTables.Where(r => r.project_id == pid).Select(r => r.UserTable).FirstOrDefault();
            return(View(data));
        }
 public ActionResult projectProgress(int id = 0)
 {
     if (Session["UserID"] != null)
     {
         if (id == 0)
         {
             id = (int)Session["projectID"];
         }
         int userId          = (int)Session["UserID"];
         DatabaseEntities db = new DatabaseEntities();
         if (db.ProjectsTables.Find(id).teamLead_id == userId)
         {
             projectProgress2    data      = new projectProgress2();
             List <projectData>  pdata     = db.projectDatas.Where(r => r.projectID == id).OrderByDescending(x => x.date).ToList();
             List <UserTable>    user      = db.teamMembersTables.Where(r => r.project_id == id).Select(r => r.UserTable).ToList();
             List <GroupPost>    grp       = db.GroupPosts.Where(r => r.projectID == id).ToList();
             List <groupMsgData> msgDetail = new List <groupMsgData>();
             foreach (var d in grp)
             {
                 groupMsgData obj = new groupMsgData();
                 obj.sender = db.UserTables.Find(d.userID);
                 obj.msg    = d;
                 msgDetail.Add(obj);
             }
             data.projectdata    = pdata;
             data.usesrData      = user;
             data.projectID      = id;
             data.loginUser      = db.UserTables.Find(userId);
             data.messagesDetail = msgDetail;
             data.teamLead       = db.ProjectsTables.Where(r => r.project_id == id).Select(r => r.UserTable).FirstOrDefault();
             return(View(data));
         }
         else
         {
             teamMembersTable tm = db.teamMembersTables.Where(r => r.project_id == id && r.user_id == userId).FirstOrDefault();
             if (tm != null)
             {
                 return(RedirectToAction("teamMemberView", "Home", new { pid = id }));
             }
             else
             {
                 return(RedirectToAction("userView", "Home", new { pid = id }));
             }
         }
     }
     else
     {
         return(RedirectToAction("Login", "Home"));
     }
 }