public ActionResult Register(TBLMEMBERS p)
 {
     if (!ModelState.IsValid)
     {
         return(View("Register"));
     }
     db.TBLMEMBERS.Add(p);
     db.SaveChanges();
     return(View("Register"));
 }
 public ActionResult AddNewMember(TBLMEMBERS p)
 {
     if (!ModelState.IsValid)
     {
         return(View("AddNewMember"));
     }
     db.TBLMEMBERS.Add(p);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
        public ActionResult UpdateMember(TBLMEMBERS p)
        {
            var member = db.TBLMEMBERS.Find(p.ID);

            member.Name      = p.Name;
            member.LastName  = p.LastName;
            member.Mail      = p.Mail;
            member.UserName  = p.UserName;
            member.Password  = p.Password;
            member.Telephone = p.Telephone;
            member.Photo     = p.Photo;
            member.School    = p.School;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult Index2(TBLMEMBERS p)
        {
            var member = (string)Session["Mail"];
            var infos  = db.TBLMEMBERS.FirstOrDefault(m => m.Mail == member);

            infos.Password  = p.Password;
            infos.Name      = p.Name;
            infos.Mail      = p.Mail;
            infos.LastName  = p.LastName;
            infos.Photo     = p.Photo;
            infos.Telephone = p.Telephone;
            infos.UserName  = p.UserName;
            infos.School    = p.School;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Login(TBLMEMBERS p)
 {
     var infos = db.TBLMEMBERS.FirstOrDefault(m => m.Mail == p.Mail && m.Password == p.Password);
     if(infos!=null)
     {
         FormsAuthentication.SetAuthCookie(infos.Mail, false);
         Session["Mail"] = infos.Mail.ToString();
         //TempData["Name"] = infos.Name.ToString();
         //TempData["ID"] = infos.ID.ToString();
         //TempData["LastName"] = infos.LastName.ToString();
         //TempData["Username"] = infos.UserName.ToString();
         //TempData["Password"] = infos.Password.ToString();
         //TempData["School"] = infos.School.ToString();
         return RedirectToAction("Index", "Panel");
     }
     else
     {
         return View();
     }
 }