コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ComplaintResponse complaintResponse = db.ComplaintResponse.Find(id);

            db.ComplaintResponse.Remove(complaintResponse);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 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));
 }
コード例 #3
0
        // 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));
        }
コード例 #4
0
        // 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));
        }
コード例 #5
0
        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);
        }