예제 #1
0
        public ActionResult AddJobQualifications(JobQualification jq)
        {
            string viewBagJobId = Request["JobId"].ToString();

            //ViewBag.Trigger = Request.Form["JobId"];
            ViewBag.QualificationId = new SelectList(db.Qualifications, "Id", "QualificationName", jq.DegreeLevel);

            if (ModelState.IsValid)
            {
                try
                {
                    jq.JobId = Convert.ToInt32(viewBagJobId);
                    if (jq.Id > 0)
                    {
                        db.Entry(jq).State = EntityState.Modified;
                        db.SaveChanges();
                    }
                    else
                    {
                        db.JobQualifications.Add(jq);
                        db.SaveChanges();
                    }
                }
                catch (Exception ex)
                {
                    ex.ToString();
                }
            }
            return(View(jq));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            JobQualification jobQualification = db.JobQualifications.Find(id);

            db.JobQualifications.Remove(jobQualification);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "ID,QualificationType,QualificationCode,Description")] JobQualification jobQualification)
 {
     if (ModelState.IsValid)
     {
         db.Entry(jobQualification).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(jobQualification));
 }
        public ActionResult Create([Bind(Include = "ID,QualificationType,QualificationCode,Description")] JobQualification jobQualification)
        {
            if (ModelState.IsValid)
            {
                db.JobQualifications.Add(jobQualification);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(jobQualification));
        }
        // GET: JobQualifications/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            JobQualification jobQualification = db.JobQualifications.Find(id);

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