public ActionResult CreatePrograms(Program program)
 {
     using (ProgramUserEntities entities = new ProgramUserEntities())
     {
         entities.Programs.Add(program);
         entities.SaveChanges();
         return(View());
     }
 }
        public ActionResult DeleteConfirmed(int id)
        {
            using (ProgramUserEntities entities = new ProgramUserEntities())
            {
                entities.Programs.Remove(entities.Programs.FirstOrDefault(p => p.ProgramId == id));
                entities.SaveChanges();

                return(RedirectToAction("Index"));
            }
        }
        public ActionResult EditProgram(Program program)
        {
            using (ProgramUserEntities entities = new ProgramUserEntities())
            {
                entities.Programs.Add(program);
                entities.SaveChanges();

                return(RedirectToAction("Index"));
            }
        }
Esempio n. 4
0
        public ActionResult EditProfile(User user)
        {
            using (ProgramUserEntities entity = new ProgramUserEntities())

            {
                entity.Entry(user).State = EntityState.Modified;
                entity.SaveChanges();
                return(RedirectToAction("Index", "Programs"));
            }
        }
Esempio n. 5
0
        public ActionResult Register(User user)

        {
            if (ModelState.IsValid)

            {
                using (ProgramUserEntities entity = new ProgramUserEntities())

                {
                    entity.Users.Add(user);

                    entity.SaveChanges();

                    ModelState.Clear();

                    user = null;

                    ViewBag.Message = "Successfully Registration Done";
                    return(RedirectToAction("GetPaidPrograms", "Programs"));
                }
            }

            return(View(user));
        }