Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            if (string.IsNullOrEmpty(Convert.ToString(Session["UserName"])))
            {
                return(RedirectToAction("Login", "Home"));
            }
            TimeTblTable timeTblTable = db.TimeTblTables.Find(id);

            db.TimeTblTables.Remove(timeTblTable);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        // GET: TimeTblTables/Details/5
        public ActionResult Details(int?id)
        {
            if (string.IsNullOrEmpty(Convert.ToString(Session["UserName"])))
            {
                return(RedirectToAction("Login", "Home"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TimeTblTable timeTblTable = db.TimeTblTables.Find(id);

            if (timeTblTable == null)
            {
                return(HttpNotFound());
            }
            return(View(timeTblTable));
        }
Exemplo n.º 3
0
        public ActionResult Edit(TimeTblTable timeTblTable)
        {
            if (string.IsNullOrEmpty(Convert.ToString(Session["UserName"])))
            {
                return(RedirectToAction("Login", "Home"));
            }
            int userid = Convert.ToInt32(Convert.ToString(Session["UserID"]));

            timeTblTable.UserID = userid;
            if (ModelState.IsValid)
            {
                db.Entry(timeTblTable).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.ClassSubjectID = new SelectList(db.ClassSubjectTables, "ClassSubjectID", "Name", timeTblTable.ClassSubjectID);
            ViewBag.StaffID        = new SelectList(db.StaffTables, "StaffID", "Name", timeTblTable.StaffID);
            ViewBag.UserID         = new SelectList(db.UserTables, "UserID", "FullName", timeTblTable.UserID);
            return(View(timeTblTable));
        }
Exemplo n.º 4
0
        // GET: TimeTblTables/Edit/5
        public ActionResult Edit(int?id)
        {
            if (string.IsNullOrEmpty(Convert.ToString(Session["UserName"])))
            {
                return(RedirectToAction("Login", "Home"));
            }

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TimeTblTable timeTblTable = db.TimeTblTables.Find(id);

            if (timeTblTable == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ClassSubjectID = new SelectList(db.ClassSubjectTables, "ClassSubjectID", "Name", timeTblTable.ClassSubjectID);
            ViewBag.StaffID        = new SelectList(db.StaffTables, "StaffID", "Name", timeTblTable.StaffID);
            ViewBag.UserID         = new SelectList(db.UserTables, "UserID", "FullName", timeTblTable.UserID);
            return(View(timeTblTable));
        }