public ActionResult DeleteConfirmed(int id) { ComplaintResponse complaintResponse = db.ComplaintResponse.Find(id); db.ComplaintResponse.Remove(complaintResponse); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "IdComplaintResponse,IdComplaint,IdEmployee,ResponseDate,detail")] ComplaintResponse complaintResponse) { if (ModelState.IsValid) { db.Entry(complaintResponse).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.IdComplaint = new SelectList(db.Complaint, "IdComplaint", "detail", complaintResponse.IdComplaint); ViewBag.IdEmployee = new SelectList(db.Employee, "IdEmployee", "Name", complaintResponse.IdEmployee); return(View(complaintResponse)); }
// GET: ComplaintResponses/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ComplaintResponse complaintResponse = db.ComplaintResponse.Find(id); if (complaintResponse == null) { return(HttpNotFound()); } return(View(complaintResponse)); }
// GET: ComplaintResponses/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ComplaintResponse complaintResponse = db.ComplaintResponse.Find(id); if (complaintResponse == null) { return(HttpNotFound()); } ViewBag.IdComplaint = new SelectList(db.Complaint, "IdComplaint", "detail", complaintResponse.IdComplaint); ViewBag.IdEmployee = new SelectList(db.Employee, "IdEmployee", "Name", complaintResponse.IdEmployee); return(View(complaintResponse)); }
public bool AddComplaintResponse(ComplaintResponseVM model) { if (model == null) { throw new Exception("There is no Entry!"); } var data = new ComplaintResponse { ComplaintResponseId = model.ComplaintResponseId, ComplaintId = model.ComplaintId, Response = model.Response, CreatedBy = model.CreatedBy, DateCreated = model.DateCreated, }; _context.ComplaintResponse.Add(data); return(_context.SaveChanges() > 0); }