示例#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 }));
        }
示例#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)));
        }
示例#3
0
        public IActionResult New()
        {
            User user = IdCheck.Check(HttpContext.Session.Id);

            if (user == null)
            {
                return(RedirectToAction("Index", "User", new { errorcode = 1 }));
            }
            return(View());
        }
示例#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"));
        }
示例#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)));
        }
示例#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"));
        }
示例#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 }));
        }
示例#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));
        }
示例#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));
        }
示例#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));
        }
示例#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());
        }
示例#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 }));
        }
示例#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));
        }
示例#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 }));
        }