// GET: agentsTaskOrdersDbs/Edit/5 public ActionResult Edit(int?id) { string CurrentLoginID = User.Identity.GetUserId().ToString(); var usID101 = from s in db.agentsDbs where s.userID == CurrentLoginID select s.userType; int usID102 = usID101.First(); if (usID102 == 2) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } agentsTaskOrdersDb agentsTaskOrdersDb = db.agentsTaskOrdersDbs.Find(id); if (agentsTaskOrdersDb == null) { return(HttpNotFound()); } ViewBag.agentsListDb = new SelectList(dbv.agentsViewDbs.OrderBy(s => s.ID), "ID", "agentNameID"); var Item41 = from s in db.agentsTaskOrdersDbs where s.ID == id select s.clientID; int Item411 = Item41.First(); var Item42 = from s in db.agentsTaskOrdersDbs where s.ID == id select s.projectID; int Item421 = Item42.First(); ViewBag.clientsDb = new SelectList(db.clientsDbs, "ID", "clientName"); ViewBag.clientsProjectsDb = new SelectList(db.clientsProjectsDbs.Where(s => s.ID == 1 || s.clientID == Item411) .OrderBy(s => s.ID), "ID", "projectName"); ViewBag.taskOrdersDb = new SelectList(db.taskOrdersDbs.Where(s => s.ID == 1 || (s.clientID == Item411 && s.projectID == Item421)) .OrderBy(s => s.ID), "ID", "taskOrder"); ViewBag.currentUserLoginID = User.Identity.GetUserId().ToString(); ViewBag.currentTimeDate101 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); return(View(agentsTaskOrdersDb)); } else { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } }
public ActionResult DeleteConfirmed(int id) { string CurrentLoginID = User.Identity.GetUserId().ToString(); var usID101 = from s in db.agentsDbs where s.userID == CurrentLoginID select s.userType; int usID102 = usID101.First(); if (usID102 == 2) { agentsTaskOrdersDb agentsTaskOrdersDb = db.agentsTaskOrdersDbs.Find(id); db.agentsTaskOrdersDbs.Remove(agentsTaskOrdersDb); db.SaveChanges(); return(RedirectToAction("Index", "agentsTaskOrders", new { projectID = 6, taskOrderID = 34, Int1 = 1 })); } else { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } }
public ActionResult Edit([Bind(Include = "ID, agentID, clientID, projectID, taskOrderID, createdDT, editedDT, createdByUserID")] agentsTaskOrdersDb agentsTaskOrdersDb) { string CurrentLoginID = User.Identity.GetUserId().ToString(); var usID101 = from s in db.agentsDbs where s.userID == CurrentLoginID select s.userType; int usID102 = usID101.First(); if (usID102 == 2) { if (ModelState.IsValid) { db.Entry(agentsTaskOrdersDb).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "agentsTaskOrders", new { projectID = 6, taskOrderID = 34, Int1 = 1 })); } return(View(agentsTaskOrdersDb)); } else { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } }
// GET: agentsTaskOrdersDbs/Delete/5 public ActionResult Delete(int?id) { string CurrentLoginID = User.Identity.GetUserId().ToString(); var usID101 = from s in db.agentsDbs where s.userID == CurrentLoginID select s.userType; int usID102 = usID101.First(); if (usID102 == 2) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } agentsTaskOrdersDb agentsTaskOrdersDb = db.agentsTaskOrdersDbs.Find(id); if (agentsTaskOrdersDb == null) { return(HttpNotFound()); } return(View(agentsTaskOrdersDb)); } else { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } }