Beispiel #1
0
        //Program Infomation Page
        public ActionResult ProgramInformation(int id)
        {
            var model = new ProgramDao(_provider).GetByid(id);

            ViewBag.imgMain = new ProgramImageDao(_provider).GetImgMain(id);
            ViewBag.ls      = new ProgramImageDao(_provider).GetAll().Where(w => w.ProID == id).ToList();
            return(View(model));
        }
        public ActionResult Edit(int id)
        {
            ViewBag.TypeProgram = new TypeProgramDao(_unitOfWork).GetAll();
            var data = new ProgramDao(_unitOfWork).GetByid(id);

            if (data == null)
            {
                return(RedirectToAction("Page404", "Error"));
            }
            return(View(data));
        }
        public ActionResult Edit(ProgramDTO program)
        {
            var data = new ProgramDao(_unitOfWork).GetByid(program.ID);

            ViewBag.TypeProgram = new TypeProgramDao(_unitOfWork).GetAll();
            if (!ModelState.IsValid)
            {
                return(View(data));
            }
            if (new ProgramDao(_unitOfWork).Edit(program))
            {
                return(RedirectToAction("Index"));
            }
            TempData[MessageConst.ERROR] = "Edit Failed";
            return(View(data));
        }
Beispiel #4
0
 public ProgramService(DbConnection myDbCon)
 {
     dao = new ProgramDao(myDbCon);
 }
Beispiel #5
0
 public ProgramService()
 {
     dao = new ProgramDao(null);
 }
        // GET: Admin/Program
        //display list of programs: hide or not hide
        public ActionResult Index()
        {
            var data = new ProgramDao(_unitOfWork).GetAll().OrderByDescending(s => s.ProDateCreate).ToList();

            return(View(data));
        }