Exemple #1
0
        public ActionResult Create(Models.Job newjob)
        {
            if (ModelState.IsValid)
            {
                // Save to the database
                var db = new JobsDataContext();

                // Sets the current revision to A, as it should be for any new job created
                newjob.curr_Revision = "A";

                db.Jobs.Add(newjob);

                // Checks to see if there are any validation errors returned by the JobsDataContext comparitor
                if (db.GetValidationErrors().Count() > 0)
                {
                    return RedirectToAction("Create");
                }
                else
                {
                    db.SaveChanges();
                }

                return RedirectToAction("Index");
            }

            return Create();
        }