Exemple #1
0
        public IActionResult Create(string type, string itemName, string speed, string damageDie, string damageType, string attackRange)
        {
            User user = IdCheck.Check(HttpContext.Session.Id);

            if (user == null)
            {
                return(RedirectToAction("Index", "User", new { errorcode = 1 }));
            }
            Item   item   = new Item();
            Weapon weapon = new Weapon();

            item.Name = itemName;
            item.Type = type;
            item.Cost = 200;

            weapon.Speed       = int.Parse(speed);
            weapon.DamageDie   = int.Parse(damageDie);
            weapon.DamageType  = damageType;
            weapon.AttackRange = int.Parse(attackRange);

            string id = DB.CreateWeapon(item, weapon);

            ViewBag.UserTitle = user.UserName;
            return(RedirectToAction("Show", new { id = id }));
        }
Exemple #2
0
        public IActionResult Show(string id)
        {
            User user = IdCheck.Check(HttpContext.Session.Id);

            if (user == null)
            {
                return(RedirectToAction("Index", "User", new { errorcode = 1 }));
            }
            return(View(DB.GetBandit(id)));
        }
Exemple #3
0
        public IActionResult New()
        {
            User user = IdCheck.Check(HttpContext.Session.Id);

            if (user == null)
            {
                return(RedirectToAction("Index", "User", new { errorcode = 1 }));
            }
            return(View());
        }
Exemple #4
0
        public IActionResult Destroy(string itemId)
        {
            User user = IdCheck.Check(HttpContext.Session.Id);

            if (user == null)
            {
                return(RedirectToAction("Index", "User", new { errorcode = 1 }));
            }
            DB.DeleteItem(itemId);
            return(RedirectToAction("Index"));
        }
Exemple #5
0
        public IActionResult Show(string id)
        {
            User user = IdCheck.Check(HttpContext.Session.Id);

            if (user == null)
            {
                return(RedirectToAction("Index", "User", new { errorcode = 1 }));
            }
            ViewBag.UserTitle = user.UserName;
            return(View(DB.GetClass(id)));
        }
Exemple #6
0
        public IActionResult New()
        {
            User user = IdCheck.Check(HttpContext.Session.Id);

            if (user == null)
            {
                return(RedirectToAction("Index", "User", new { errorcode = 1 }));
            }
            ViewBag.UserTitle = user.UserName;
            return(View("New"));
        }
Exemple #7
0
        public IActionResult Create(string banditName, string banditClass)
        {
            User user = IdCheck.Check(HttpContext.Session.Id);

            if (user == null)
            {
                return(RedirectToAction("Index", "User", new { errorcode = 1 }));
            }
            string id = DB.CreateBandit(banditName, int.Parse(banditClass));

            return(RedirectToAction("Show", new { id = id }));
        }
Exemple #8
0
        public IActionResult New()
        {
            User user = IdCheck.Check(HttpContext.Session.Id);

            if (user == null)
            {
                return(RedirectToAction("Index", "User", new { errorcode = 1 }));
            }
            Byte[] dataOut;
            HttpContext.Session.TryGetValue("Id", out dataOut);
            return(View("New", dataOut));
        }
Exemple #9
0
        public IActionResult Index()
        {
            User user = IdCheck.Check(HttpContext.Session.Id);

            if (user == null)
            {
                return(RedirectToAction("Index", "User", new { errorcode = 1 }));
            }
            List <ItemStats> items = DB.GetAllItemStats();

            return(View(items));
        }
Exemple #10
0
        public IActionResult Index()
        {
            User user = IdCheck.Check(HttpContext.Session.Id);

            if (user == null)
            {
                return(RedirectToAction("Index", "User", new { errorcode = 1 }));
            }

            List <Bandit> bandits = DB.GetAll();

            return(View(bandits));
        }
Exemple #11
0
        public IActionResult Show(string id)
        {
            User user = IdCheck.Check(HttpContext.Session.Id);

            if (user == null)
            {
                return(RedirectToAction("Index", "User", new { errorcode = 1 }));
            }
            ViewBag.Item      = DB.GetItem(id);
            ViewBag.ItemStats = DB.GetItemStats(ViewBag.Item.Type_Id.ToString(), ViewBag.Item.Type);
            ViewBag.UserTitle = user.UserName;
            return(View());
        }
Exemple #12
0
        public IActionResult Create(string className, string totalHealth, string currentHealth, string strength, string dexterity)
        {
            User user = IdCheck.Check(HttpContext.Session.Id);

            if (user == null)
            {
                return(RedirectToAction("Index", "User", new { errorcode = 1 }));
            }
            string id = DB.CreateClass(className, totalHealth, currentHealth, strength, dexterity);;

            ViewBag.UserTitle = user.UserName;
            return(RedirectToAction("Show", new { id = id }));
        }
Exemple #13
0
        public IActionResult Index()
        {
            User user = IdCheck.Check(HttpContext.Session.Id);

            if (user == null)
            {
                return(RedirectToAction("Index", "User", new { errorcode = 1 }));
            }

            List <Classes> allClasses = DB.GetAllClasses();

            ViewBag.UserTitle = user.UserName;
            return(View(allClasses));
        }
Exemple #14
0
        public IActionResult Create(string type, string itemName, string speed, string damageDie, string damageType, string attackRange)
        {
            User user = IdCheck.Check(HttpContext.Session.Id);

            if (user == null)
            {
                return(RedirectToAction("Index", "User", new { errorcode = 1 }));
            }
            ItemStats item = new ItemStats();

            item.Type        = type;
            item.Name        = itemName;
            item.Speed       = int.Parse(speed);
            item.DamageDie   = int.Parse(damageDie);
            item.DamageType  = damageType;
            item.AttackRange = int.Parse(attackRange);

            string id = DB.CreateItem(item);

            return(RedirectToAction("Show", new { id = id }));
        }