コード例 #1
0
        public ActionResult Create(InternshipOffer internshipoffer)
        {
            if (ModelState.IsValid)
            {
                internshipoffer.adminID = 1;
                User admin = db.Users.Find(1);
                internshipoffer.admin = admin;
                db.Internships.Add(internshipoffer);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(internshipoffer);
        }
コード例 #2
0
        public ActionResult Edit(int id, InternshipOffer internship)
        {
            InternshipOffer _internship = db.Internships.Find(id);

            if (ModelState.IsValid)
            {
                _internship.poste = internship.poste;
                _internship.place = internship.place;
                _internship.activity = internship.activity;
                _internship.nbreInterns = internship.nbreInterns;
                _internship.dateOffre = internship.dateOffre;
                _internship.dateStart = internship.dateStart;
                _internship.dateEnd = internship.dateEnd;
                _internship.description = internship.description;
                _internship.techKnow = internship.techKnow;
                _internship.praticKnow = internship.praticKnow;

                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(internship);
        }