public async Task <ActionResult> DeleteConfirmed(int id) { TblRespons tblRespons = await db.TblResponses.FindAsync(id); db.TblResponses.Remove(tblRespons); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Create([Bind(Include = "ResponseId,RequestId,UserId,Comment")] TblRespons tblRespons) { if (ModelState.IsValid) { db.TblResponses.Add(tblRespons); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.RequestId = new SelectList(db.TblRequests, "RequestId", "Title", tblRespons.RequestId); ViewBag.UserId = new SelectList(db.TblUsers, "UserId", "Name", tblRespons.UserId); return(View(tblRespons)); }
// GET: TblRespons/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TblRespons tblRespons = await db.TblResponses.FindAsync(id); if (tblRespons == null) { return(HttpNotFound()); } return(View(tblRespons)); }
public async Task <ActionResult> Edit([Bind(Include = "Comment")] TblRespons tblRespons) { if (ModelState.IsValid) { if (Session["RequestId"] != null && Session["UserId"] != null) { tblRespons.RequestId = Convert.ToInt32(Session["RequestId"]); tblRespons.UserId = Convert.ToInt32(Session["UserId"]); db.TblResponses.Add(tblRespons); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View()); } return(View("Index", tblRespons)); }