예제 #1
0
        public ActionResult Create([Bind(Include = "CountryID,CountryName,Flag")] Country country)
        {
            if (ModelState.IsValid)
            {
                db.Country.Add(country);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(country));
        }
예제 #2
0
        public ActionResult Create([Bind(Include = "UserID,FirstName,LastName,Email,UserPassword,RoleID,StatusID")] Users users)
        {
            if (ModelState.IsValid)
            {
                db.Users.Add(users);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.RoleID   = new SelectList(db.RoleType, "RoleID", "RoleName", users.RoleID);
            ViewBag.StatusID = new SelectList(db.UserStatus, "StatusID", "StatusDesc", users.StatusID);
            return(View(users));
        }
예제 #3
0
        public ActionResult Create([Bind(Include = "ClubID,ClubName,ClubFullName,CountryID,FoundationDate,CityClub,PriceMerch,ImageShield,ClubHistory,President,Stadium,WebSite")] Club club, HttpPostedFileBase photoCreate)
        {
            if (photoCreate != null)
            {
                club.ImageShield = new byte[photoCreate.ContentLength];
                photoCreate.InputStream.Read(club.ImageShield, 0, photoCreate.ContentLength);
            }

            if (ModelState.IsValid)
            {
                db.Club.Add(club);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CountryID = new SelectList(db.Country, "CountryID", "CountryName", club.CountryID);
            return(View(club));
        }
예제 #4
0
        public ActionResult Create([Bind(Include = "ManagerID,FirstName,LastName,NickName,DateOfBirth,CountryID,ClubID,Photo")] Manager manager, HttpPostedFileBase photoCreate)
        {
            if (photoCreate != null)
            {
                manager.Photo = new byte[photoCreate.ContentLength];
                photoCreate.InputStream.Read(manager.Photo, 0, photoCreate.ContentLength);
            }

            if (ModelState.IsValid)
            {
                db.Manager.Add(manager);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ClubID    = new SelectList(db.Club, "ClubID", "ClubName", manager.ClubID);
            ViewBag.CountryID = new SelectList(db.Country, "CountryID", "CountryName", manager.CountryID);
            return(View(manager));
        }
예제 #5
0
        public ActionResult Create([Bind(Include = "PlayerID,FirstName,LastName,NickName,DateOfBirth,CountryID,PositionID,ClubID,PlayerStatusID,Photo,Appearances,YellowCard,RedCard,GoalsScored,Height,PricePass,Number")] Player player, HttpPostedFileBase photoCreate)
        {
            if (photoCreate != null)
            {
                player.Photo = new byte[photoCreate.ContentLength];
                photoCreate.InputStream.Read(player.Photo, 0, photoCreate.ContentLength);
            }

            if (ModelState.IsValid)
            {
                db.Player.Add(player);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ClubID         = new SelectList(db.Club, "ClubID", "ClubName", player.ClubID);
            ViewBag.CountryID      = new SelectList(db.Country, "CountryID", "CountryName", player.CountryID);
            ViewBag.PlayerStatusID = new SelectList(db.PlayerStatus, "PlayerStatusID", "NameStatus", player.PlayerStatusID);
            ViewBag.PositionID     = new SelectList(db.Position, "PositionID", "Position1", player.PositionID);
            return(View(player));
        }