public ActionResult Edit([Bind(Include = "AuthId,password,Auth_Role")] Auth auth)
        {
            if (Session["id"] == null)
            {
                TempData["login"] = "******";
                return(RedirectToAction("Login", "Login"));
            }
            if (!Session["Role"].ToString().ToLower().Equals("admin"))
            {
                TempData["auth"] = "You are not Authorized so move back";
                return(RedirectToAction("Index", "Employees"));
            }
            var f = 0;

            ViewBag.error = "";
            if (!auth.Auth_Role.ToLower().Equals("admin") && !auth.Auth_Role.ToLower().Equals("user"))
            {
                f              = 1;
                ViewBag.error += "  Invalid Role.";
            }
            if (auth.password.Length >= 10)
            {
                f              = 1;
                ViewBag.error += "   password length must be less than 10";
            }
            if (ModelState.IsValid && f == 0)
            {
                db.Entry(auth).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.AuthId = new SelectList(db.employees, "EmployeeId", "Name", auth.AuthId);
            return(View(auth));
        }
        public ActionResult verify1(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            if (Session["id"] == null)
            {
                TempData["login"] = "******";
                return(RedirectToAction("Login", "Login"));
            }
            if (!Session["Role"].Equals("admin"))
            {
                TempData["auth"] = "You are not Authorized so move back";
                return(RedirectToAction("Index", "Confirmations"));
            }
            Confirmation con   = db.Confirmations.Find(id);
            string       path  = @"C:\Users\Kishan\source\repos\Project\Project\confirmation_certificate\" + con.employee.Name + @"\" + con.ftype + @"\" + con.fname;
            string       path1 = @"C:\Users\Kishan\source\repos\Project\Project\directory\" + con.employee.Name + @"\";

            if (con.ftype == "Educational")
            {
                path1 = path1 + @"Educational_Certificates\" + con.fname;
            }
            else if (con.ftype.Equals("Workshop"))
            {
                path1 = path1 + @"Workshop_Certificates\" + con.fname;
            }
            else if (con.ftype.Equals("Training"))
            {
                path1 = path1 + @"Training_Certificates\" + con.fname;
            }
            System.IO.File.Move(path, path1);
            con.status          = "Verified";
            db.Entry(con).State = EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("verify", "Confirmations"));
        }
 public ActionResult Edit([Bind(Include = "Training_DetailsId,EmployeeId,Begin_Date,End_Date,Subject,Description")] Training_Details training_Details)
 {
     if (Session["id"] == null)
     {
         TempData["login"] = "******";
         return(RedirectToAction("Login", "Login"));
     }
     if (!Session["id"].Equals(training_Details.EmployeeId))
     {
         TempData["auth"] = "You are not Authorized so move back";
         return(RedirectToAction("Index", "Training_Details"));
     }
     if (ModelState.IsValid)
     {
         db.Entry(training_Details).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.EmployeeId = new SelectList(db.employees, "EmployeeId", "Name", training_Details.EmployeeId);
     return(View(training_Details));
 }
 public ActionResult Edit([Bind(Include = "Turnkey_ProjectId,EmployeeId,Project_Name,Begin_Date,End_Date,Role,Description,Team_Size")] Turnkey_Project turnkey_Project)
 {
     if (Session["id"] == null)
     {
         TempData["login"] = "******";
         return(RedirectToAction("Login", "Login"));
     }
     if (!Session["id"].Equals(turnkey_Project.EmployeeId))
     {
         TempData["auth"] = "You are not Authorized so move back";
         return(RedirectToAction("Index", "Turnkey_Project"));
     }
     if (ModelState.IsValid)
     {
         db.Entry(turnkey_Project).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.EmployeeId = new SelectList(db.employees, "EmployeeId", "Name", turnkey_Project.EmployeeId);
     return(View(turnkey_Project));
 }
Exemple #5
0
        public ActionResult Edit([Bind(Include = "EmployeeId,Name,Dob,Permanent_Addr,Current_Addr,Marital_Status,Gender,Contact_No,Email,Blood_Group")] Employee employee)
        {
            if (Session["id"] == null)
            {
                TempData["login"] = "******";
                return(RedirectToAction("Login", "Login"));
            }
            if (!Session["id"].Equals(employee.EmployeeId))
            {
                TempData["auth"] = "You are not Authorized so move back";
                return(RedirectToAction("Index", "Employees"));
            }
            var f = 0;

            if (employee.Contact_No.Length != 10)
            {
                ViewBag.error += "Invalid Contact-No.";
                f              = 1;
            }
            if (employee.Name.Length > 15)
            {
                f              = 1;
                ViewBag.error += "  Name length must be less than 16.";
            }
            if (!employee.Gender.ToLower().Equals("male") && !employee.Gender.ToLower().Equals("female"))
            {
                f              = 1;
                ViewBag.error += "  Invalid Gender.";
            }
            if (ModelState.IsValid && f == 0)
            {
                db.Entry(employee).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.EmployeeId = new SelectList(db.auths, "AuthId", "password", employee.EmployeeId);
            return(View(employee));
        }