コード例 #1
0
 partial void Deletesh_career(sh_career instance);
コード例 #2
0
 partial void Updatesh_career(sh_career instance);
コード例 #3
0
ファイル: APIController.cs プロジェクト: jmaag/studioelement
        private string getInstruction(sh_career career, ref int index)
        {
            string result = "";
            switch (index)
            {
                case 0:
                    result = career.Level1Instructions;
                    break;
                case 1:
                    result = career.Level2Instructions;
                    break;
                case 2:
                    result = career.Level3Instructions;
                    break;
                case 3:
                    result = career.Level4Instructions;
                    break;
                case 4:
                    result = career.Level5Instructions;
                    break;
            }

            index++;
            return result;
        }
コード例 #4
0
 partial void Insertsh_career(sh_career instance);
コード例 #5
0
        public ActionResult New(CareerModel model)
        {
            if (ModelState.IsValid)
            {
                var career = new sh_career()
                {
                    AverageSalary = model.AverageSalary,
                    Demand = model.Demand,
                    DisplayOrder = model.DisplayOrder,
                    Level1Instructions = model.Level1Instructions,
                    Level2Instructions = model.Level2Instructions,
                    Level3Instructions = model.Level3Instructions,
                    Level4Instructions = model.Level4Instructions,
                    Level5Instructions = model.Level5Instructions,
                    Description = model.Description,
                    Name = model.Name
                };

                // create the career
                Context.sh_careers.InsertOnSubmit(career);

                // save to the database
                Context.SubmitChanges();

                // create the associated certifications
                if (model.SelectedCerts != null)
                {
                    foreach (var id in model.SelectedCerts)
                    {
                        sh_career_certification assoc = new sh_career_certification() { CareerID = career.CareerID, CertificationID = id };
                        Context.sh_career_certifications.InsertOnSubmit(assoc);
                    }
                }

                // save to the database again
                Context.SubmitChanges();

                return RedirectToAction("Edit", new { id = career.CareerID });
            }

            return View(getModel());
        }