Ejemplo n.º 1
0
        public ActionResult Create([Bind(Include = "DeveloperId,Name,Description")] Developer developer)
        {
            bool Banned = false;

            foreach (Blacklist blacklist in dbBlacklist.Blacklists.ToList())
            {
                if (blacklist.BlacklistIP == Request.UserHostAddress)
                {
                    Banned = true;
                }
            }

            if (ModelState.IsValid && Banned == false)
            {
                db.Developers.Add(developer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            if (Banned == true)
            {
                return(RedirectToAction("../Blacklists/UserBlacklist/"));
            }
            else
            {
                return(View(developer));
            }
        }
Ejemplo n.º 2
0
        public ActionResult Post(Developer devDto)
        {
            var dev = new Developer {
                FirstName = devDto.FirstName, Email = devDto.Email
            };

            _context.Developer.Add(dev);
            _context.SaveChanges();
            return(Ok(dev));
        }
Ejemplo n.º 3
0
        public ActionResult Create([Bind(Include = "DeveloperID,DeveloperName,StartDate,Description,GamesProduced")] Developer developer)
        {
            if (ModelState.IsValid)
            {
                db.Developers.Add(developer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(developer));
        }