Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [HttpPost]
- [ValidateAntiForgeryToken]
- public ActionResult Create([Bind(Include="Name,CoachID,DivisionID,Established,Wins,Draw,Loss,GoalsScored,GoalsConceived")] Club club, HttpPostedFileBase logo)
- {
- if (ModelState.IsValid)
- {
- int imageLength = logo.ContentLength;
- byte[] imageBytes = new byte[imageLength];
- logo.InputStream.Read(imageBytes, 0, imageLength);
- club.Logo = imageBytes;
- db.Clubs.Add(club);
- db.SaveChanges();
- return RedirectToAction("Index");
- }
- ViewBag.CoachID = new SelectList(db.Coaches, "CoachID", "Name", club.CoachID);
- ViewBag.DivisionID = new SelectList(db.Divisions, "DivisionID", "Name", club.DivisionID);
- return View(club);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement