コード例 #1
0
 //    [ValidateAntiForgeryToken]
 public ActionResult Login(Trainer_Details model)
 {
     if (ModelState.IsValid)
     {
         Database1Entities1 db = new Database1Entities1();
         var user = (from Mem_Tab in db.Mem_Tab
                     where Mem_Tab.Email == model.TEmail && Mem_Tab.PWD == model.TPWD
                     select new
         {
             model.TEmail,
             model.TName
         }).ToList();
         if (user.FirstOrDefault() != null)
         {
             Session["Email"] = user.FirstOrDefault().TEmail;
             Session["Name"]  = user.FirstOrDefault().TName;
             //return View("Create", "Resumes");
         }
         else
         {
             ModelState.AddModelError("", "Invalid login credentials.");
         }
     }
     return(RedirectToAction("Create", "Resumes"));
 }
コード例 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Trainer_Details trainer_Details = db.Trainer_Details.Find(id);

            db.Trainer_Details.Remove(trainer_Details);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "TId,TName,TDOB,TDateofjoin,TSalary,TQualification,TSchedule,TEmail,TPWD")] Trainer_Details trainer_Details)
 {
     if (ModelState.IsValid)
     {
         db.Entry(trainer_Details).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(trainer_Details));
 }
コード例 #4
0
        // GET: Trainer_Details/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Trainer_Details trainer_Details = db.Trainer_Details.Find(id);

            if (trainer_Details == null)
            {
                return(HttpNotFound());
            }
            return(View(trainer_Details));
        }