Beispiel #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            if (string.IsNullOrEmpty(Convert.ToString(Session["UserName"])))
            {
                return(RedirectToAction("Login", "Home"));
            }
            AnnualTable annualTable = db.AnnualTables.Find(id);

            db.AnnualTables.Remove(annualTable);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
        // GET: AnnualTables/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));
            }
            AnnualTable annualTable = db.AnnualTables.Find(id);

            if (annualTable == null)
            {
                return(HttpNotFound());
            }
            return(View(annualTable));
        }
Beispiel #3
0
        // GET: AnnualTables/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));
            }
            AnnualTable annualTable = db.AnnualTables.Find(id);

            if (annualTable == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ProgrameID = new SelectList(db.ProgrameTables.Where(p => p.IsActive == true), "ProgrameID", "Name", annualTable.ProgrameID);
            ViewBag.UserID     = new SelectList(db.UserTables, "UserID", "FullName", annualTable.UserID);
            return(View(annualTable));
        }
Beispiel #4
0
        public ActionResult Edit(AnnualTable annualTable)
        {
            if (string.IsNullOrEmpty(Convert.ToString(Session["UserName"])))
            {
                return(RedirectToAction("Login", "Home"));
            }
            int userid = Convert.ToInt32(Convert.ToString(Session["UserID"]));

            annualTable.UserID = userid;

            if (ModelState.IsValid)
            {
                db.Entry(annualTable).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.ProgrameID = new SelectList(db.ProgrameTables.Where(p => p.IsActive == true), "ProgrameID", "Name", annualTable.ProgrameID);
            ViewBag.UserID     = new SelectList(db.UserTables, "UserID", "FullName", annualTable.UserID);
            return(View(annualTable));
        }