public ActionResult DeleteConfirmed(int id)
        {
            tblChatLog tblChatLog = db.tblChatLogs.Find(id);

            db.tblChatLogs.Remove(tblChatLog);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "iChatLogID,dtAdded,iAddedBy,dtEdited,iEditedBy,iUserID,strFirstName,strSurname,strEmailAddress,strContactNumber,dtEndOfChat,strRef,iReasonForChatID,iStatusID,bIsDeleted")] tblChatLog tblChatLog)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblChatLog).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.iReasonForChatID = new SelectList(db.tblReasonForChats, "iReasonForChatID", "strReason", tblChatLog.iReasonForChatID);
     ViewBag.iStatusID        = new SelectList(db.tblStatuses, "iStatusID", "strStatus", tblChatLog.iStatusID);
     ViewBag.iUserID          = new SelectList(db.tblUsers, "iUserID", "strFirstName", tblChatLog.iUserID);
     return(View(tblChatLog));
 }
        // GET: tblChatLogs/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblChatLog tblChatLog = db.tblChatLogs.Find(id);

            if (tblChatLog == null)
            {
                return(HttpNotFound());
            }
            return(View(tblChatLog));
        }
        // GET: tblChatLogs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblChatLog tblChatLog = db.tblChatLogs.Find(id);

            if (tblChatLog == null)
            {
                return(HttpNotFound());
            }
            ViewBag.iReasonForChatID = new SelectList(db.tblReasonForChats, "iReasonForChatID", "strReason", tblChatLog.iReasonForChatID);
            ViewBag.iStatusID        = new SelectList(db.tblStatuses, "iStatusID", "strStatus", tblChatLog.iStatusID);
            ViewBag.iUserID          = new SelectList(db.tblUsers, "iUserID", "strFirstName", tblChatLog.iUserID);
            return(View(tblChatLog));
        }
        public ActionResult Create([Bind(Include = "iChatLogID,dtAdded,iAddedBy,dtEdited,iEditedBy,iUserID,strFirstName,strSurname,strEmailAddress,strContactNumber,dtEndOfChat,strRef,iReasonForChatID,iStatusID,bIsDeleted")] tblChatLog tblChatLog)
        {
            if (ModelState.IsValid)
            {
                // standard SU creation properties
                tblChatLog.iAddedBy    = 0;
                tblChatLog.dtAdded     = DateTime.Now;
                tblChatLog.iEditedBy   = 0;
                tblChatLog.dtEdited    = DateTime.Now;
                tblChatLog.bIsDeleted  = false;
                tblChatLog.dtEndOfChat = DateTime.Now;
                tblChatLog.strRef      = "to be added";

                db.tblChatLogs.Add(tblChatLog);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.iReasonForChatID = new SelectList(db.tblReasonForChats, "iReasonForChatID", "strReason", tblChatLog.iReasonForChatID);
            ViewBag.iStatusID        = new SelectList(db.tblStatuses, "iStatusID", "strStatus", tblChatLog.iStatusID);
            ViewBag.iUserID          = new SelectList(db.tblUsers, "iUserID", "strFirstName", tblChatLog.iUserID);
            return(View(tblChatLog));
        }