Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public partial class Idea
- {
- public int Idea_Id { get; set; }
- public string Idea_Name { get; set; }
- public string Technology { get; set; }
- public string Description { get; set; }
- public int dept_id { get; set; }
- public Nullable<int> UserID { get; set; }
- public string Address { get; set; }
- public virtual department department { get; set; }
- public virtual User User { get; set; }
- }
- public ActionResult Create()
- {
- ViewBag.dept_id = new SelectList(db.departments, "dep_id", "dep_name");
- ViewBag.UserID = new SelectList(db.Users, "UserID", "Username");
- return View();
- }
- // POST: Ideas/Create
- // To protect from overposting attacks, please enable the specific properties you want to bind to, for
- // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
- [HttpPost]
- [ValidateAntiForgeryToken]
- public ActionResult Create([Bind(Include = "Idea_Id,Idea_Name,Technology,Start_Date,End_Date,Description,dept_id,UserID")] Idea idea)
- {
- if (ModelState.IsValid)
- {
- db.Ideas.Add(idea);
- db.SaveChanges();
- return RedirectToAction("Index");
- }
- ViewBag.dept_id = new SelectList(db.departments, "dep_id", "dep_name", idea.dept_id);
- ViewBag.UserID = new SelectList(db.Users, "UserID", "Username", idea.UserID);
- return View(idea);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement