Example #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            teamtbl teamtbl = db.teamtbls.Find(id);

            db.teamtbls.Remove(teamtbl);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #2
0
        // GET: team/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            teamtbl teamtbl = db.teamtbls.Find(id);

            if (teamtbl == null)
            {
                return(HttpNotFound());
            }
            return(View(teamtbl));
        }
Example #3
0
 public ActionResult Edit([Bind(Include = "team_id,dep_id,pro_id,user_id,role_id")] teamtbl teamtbl)
 {
     if (ModelState.IsValid)
     {
         db.Entry(teamtbl).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.pro_id  = new SelectList(db.projecttbls, "pro_id", "pro_name", teamtbl.pro_id);
     ViewBag.role_id = new SelectList(db.roletbls, "role_id", "role_name", teamtbl.role_id);
     ViewBag.user_id = new SelectList(db.UserTbls, "user_id", "user_name", teamtbl.user_id);
     ViewBag.dep_id  = new SelectList(db.departmenttbls, "dep_id", "dep_name", teamtbl.dep_id);
     return(View(teamtbl));
 }
Example #4
0
        public ActionResult Create([Bind(Include = "team_id,dep_id,pro_id,user_id,role_id")] teamtbl teamtbl)
        {
            if (ModelState.IsValid)
            {
                db.teamtbls.Add(teamtbl);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.pro_id  = new SelectList(db.projecttbls, "pro_id", "pro_name", teamtbl.pro_id);
            ViewBag.role_id = new SelectList(db.roletbls, "role_id", "role_name", teamtbl.role_id);
            ViewBag.user_id = new SelectList(db.UserTbls, "user_id", "user_name", teamtbl.user_id);
            ViewBag.dep_id  = new SelectList(db.departmenttbls, "dep_id", "dep_name", teamtbl.dep_id);
            return(View(teamtbl));
        }
Example #5
0
        // GET: team/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            teamtbl teamtbl = db.teamtbls.Find(id);

            if (teamtbl == null)
            {
                return(HttpNotFound());
            }
            ViewBag.pro_id  = new SelectList(db.projecttbls, "pro_id", "pro_name", teamtbl.pro_id);
            ViewBag.role_id = new SelectList(db.roletbls, "role_id", "role_name", teamtbl.role_id);
            ViewBag.user_id = new SelectList(db.UserTbls, "user_id", "user_name", teamtbl.user_id);
            ViewBag.dep_id  = new SelectList(db.departmenttbls, "dep_id", "dep_name", teamtbl.dep_id);
            return(View(teamtbl));
        }
Example #6
0
        public int isUserRoleID(Loginmodel Objlogin)
        {
            //get Roll iD for controller dashboard
            var role = 0; var roleid = 0;

            try {
                using (var entity = new HapinessSurveyEntities())
                {
                    teamtbl teamobj = new teamtbl();
                    role = (int)entity.teamtbls.Where(a => a.user_id.Equals(isuservalue)).LongCount();
                    if (role == 1)
                    {
                        roleid = entity.teamtbls.Where(a => a.user_id.Equals(isuservalue)).Select(a => a.role_id).FirstOrDefault();

                        //if assign any one role.
                    }
                    else if (role == 0)
                    {
                        roleid = role;
                        //if not assign any role
                    }
                    else if (role == 2)
                    {
                        //if teamlead and teammember role
                        // var roleid1 = entity.teamtbls.Where(a => a.user_id.Equals(isuservalue)).Select(a => a.role_id).ToList();
                        //  roleid = roleid1.Min();
                        roleid = 6;
                        // roleid = entity.teamtbls.Where(a => a.user_id.Equals(isuservalue)).Select(a => a.role_id).Min();
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(roleid);
        }