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) { toInquriesChanelDb toInquriesChanelDb = db.toInquriesChanelDbs.Find(id); db.toInquriesChanelDbs.Remove(toInquriesChanelDb); db.SaveChanges(); return(RedirectToAction("Index", "toInquriesChanel", new { projectID = 6, taskOrderID = 26, Int1 = 1 })); } else { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } }
public ActionResult Edit([Bind(Include = "ID, clientID, projectID, taskOrderID, inquryChanel, createdDT, editedDT, createdByUserID")] toInquriesChanelDb toInquriesChanelDb) { 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(toInquriesChanelDb).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "toInquriesChanel", new { projectID = 6, taskOrderID = 26, Int1 = 1 })); } return(View(toInquriesChanelDb)); } else { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } }
// GET: toInquriesChanelDbs/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)); } toInquriesChanelDb toInquriesChanelDb = db.toInquriesChanelDbs.Find(id); if (toInquriesChanelDb == null) { return(HttpNotFound()); } var Item41 = from s in db.toInquriesChanelDbs where s.ID == id select s.clientID; int Item411 = Item41.Single(); var Item42 = from s in db.toInquriesChanelDbs where s.ID == id select s.projectID; int Item421 = Item42.Single(); ViewBag.clientsDb = new SelectList(db.clientsDbs, "ID", "clientName"); ViewBag.clientsProjectsDb = new SelectList(db.clientsProjectsDbs.Where(s => s.ID == 1 || s.clientID == Item411), "ID", "projectName"); ViewBag.taskOrdersDb = new SelectList(db.taskOrdersDbs.Where(s => s.ID == 1 || (s.clientID == Item411 && s.projectID == Item421)), "ID", "taskOrder"); ViewBag.currentUserLoginID = User.Identity.GetUserId().ToString(); ViewBag.currentTimeDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); return(View(toInquriesChanelDb)); } else { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } }
// GET: toInquriesChanelDbs/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)); } toInquriesChanelDb toInquriesChanelDb = db.toInquriesChanelDbs.Find(id); if (toInquriesChanelDb == null) { return(HttpNotFound()); } return(View(toInquriesChanelDb)); } else { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } }