public ActionResult RemoveTrainee() { workson w = db.worksontable.Single(e => e.trainee.userid == train); db.worksontable.Remove(w); db.SaveChanges(); return(RedirectToAction("TeamleaderCurrent")); }
public ActionResult Dmember(int id) { user u = db.usertable.Find(id); if (u.status.Equals("Marketing team leader")) { project p = db.projecttable.Find(proid); db.Entry(p).Reference("leader").CurrentValue = null; db.SaveChanges(); } else { workson x = db.worksontable.Single(e => e.trainee.userid == id & e.workignproject.projectid == proid); db.worksontable.Remove(x); db.SaveChanges(); } return(RedirectToAction("MDDeleteMember")); }
public ActionResult Acceptrequest(int id, int pid) { int i = Int32.Parse(WelcomeController.Tempid); var x = from e in db.usertable join p in db.usertable on e.userid equals p.userid where e.userid == i select new viewmodel { u = e }; ViewData["info"] = x.ToList(); workson w = new workson(); user trainee = db.usertable.Find(i); project pro = db.projecttable.Find(pid); w.trainee = trainee; w.workignproject = pro; db.worksontable.Add(w); db.SaveChanges(); drrequest d = db.drrequesttable.Find(id); d.status = "accept"; db.SaveChanges(); return(RedirectToAction("MTRequests")); }