Exemplo n.º 1
0
 public ActionResult Edit([Bind(Include = "jobId,applicantList,jobName,applicationStart,applicationFinish,questionNumber")] Job job)
 {
     if (ModelState.IsValid)
     {
         db.Entry(job).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(job));
 }
Exemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "questionId,question1,cd_creater,dt_created,category")] Question question)
 {
     if (ModelState.IsValid)
     {
         question.cd_modifier     = (int)Session["userId"];
         question.dt_modified     = DateTime.Now;
         db.Entry(question).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(question));
 }
Exemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "categoryId,categoryName")] Category category)
 {
     if (Session["userName"] == null)
     {
         // If non user person wants to reach Edit page.
         return(RedirectToAction("NotAuthorized", "Home"));
     }
     if ((int)Session["isAdmin"] == 0)
     {
         return(RedirectToAction("NotAuthorized", "Home"));
     }
     if (ModelState.IsValid)
     {
         db.Entry(category).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(category));
 }
Exemplo n.º 4
0
        public ActionResult Edit(InterviewQuestionPaper interviewQuestionPaper)
        {
            NameValueCollection nvc = Request.Form;
            int           i         = 0;
            string        name      = "answer_" + i.ToString();
            List <string> answers   = new List <string>();

            while (!string.IsNullOrEmpty(nvc[name]))
            {
                answers.Add(nvc[name]);
                i++;
                name = "answer_" + i.ToString();
            }

            /*
             * string userName, password;
             * if (!string.IsNullOrEmpty(nvc["txtUserName"]))
             * {
             *  userName = nvc["txtUserName"];
             * }
             *
             * if (!string.IsNullOrEmpty(nvc["txtPassword"]))
             * {
             *  password = nvc["txtPassword"];
             * }*/


            if (ModelState.IsValid)
            {
                int         applicationId = (int)interviewQuestionPaper.applicationId;
                Application application   = db.Applications.Find(applicationId);
                application.status                     = "Pending";
                interviewQuestionPaper.answers         = String.Join(",", answers);
                interviewQuestionPaper.dt_modified     = DateTime.Now;
                interviewQuestionPaper.cd_modifier     = (int)Session["userId"];
                db.Entry(interviewQuestionPaper).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index", "Applications"));
            }
            ViewBag.applicationId = new SelectList(db.Applications, "applicationId", "applicationId", interviewQuestionPaper.applicationId);
            ViewBag.userId        = new SelectList(db.Users, "userId", "name", interviewQuestionPaper.userId);
            return(View(interviewQuestionPaper));
        }
        public ActionResult Edit([Bind(Include = "reviewId,userId,paperId,jobId,applicationId,review1,status,interviewDate,dt_created,dt_modified,cd_creater,cd_modifier")] Review review)
        {
            if (ModelState.IsValid)
            {
                review.dt_modified = DateTime.Now;
                review.cd_modifier = (int)Session["userId"];
                Application application = db.Applications.Find(review.applicationId);

                application.status = review.status;

                db.Entry(review).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index", "Applications"));
            }
            ViewBag.applicationId = new SelectList(db.Applications, "applicationId", "status", review.applicationId);
            ViewBag.paperId       = new SelectList(db.InterviewQuestionPapers, "paperId", "answer1", review.paperId);
            ViewBag.jobId         = new SelectList(db.Jobs, "jobId", "applicantList", review.jobId);
            ViewBag.userId        = new SelectList(db.Users, "userId", "name", review.userId);
            return(View(review));
        }
Exemplo n.º 6
0
 public ActionResult Edit([Bind(Include = "newId,header,text,image,BoolValue,featuredList,dt_created,dt_modified,cd_creater,cd_modifier")] New @new)
 {
     if (Session["userName"] == null)
     {
         // If non user person wants to reach Edit page.
         return(RedirectToAction("NotAuthorized", "Home"));
     }
     if ((int)Session["isAdmin"] == 0)
     {
         return(RedirectToAction("NotAuthorized", "Home"));
     }
     if (ModelState.IsValid)
     {
         @new.dt_modified     = DateTime.Now;
         @new.cd_modifier     = (int)Session["userId"];
         db.Entry(@new).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(@new));
 }
Exemplo n.º 7
0
        public ActionResult Edit(User user)
        {
            if (ModelState.IsValid)
            {
                // Check for email is already in use or not.
                bool alreadyexists = false;

                // Iterate in Database
                foreach (User u in db.Users.ToList())
                {
                    if (u.email.Equals(user.email) && !(user.userId.Equals(u.userId)))
                    {                        // If already in use break the loop and change match data.
                        alreadyexists = true;
                        break;
                    }
                }

                if (alreadyexists)
                {
                    // In case of duplicate emails, produce an error message and return back to register page.
                    ModelState.AddModelError(string.Empty, "This email already in use.");
                    return(RedirectToAction("Edit", new { id = user.userId }));
                }

                if ((int)Session["isAdmin"] != 1)
                {
                    user.BoolValue = false;
                }
                user.cd_modifier     = (int)Session["userId"];
                user.dt_modified     = DateTime.Now;
                db.Entry(user).State = EntityState.Modified;
                db.SaveChanges();
                if ((int)Session["isAdmin"] != 1)
                {
                    return(RedirectToAction("Details", new { id = user.userId }));
                }
                return(RedirectToAction("Index"));
            }
            return(View(user));
        }