Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("ID,ChallengeRating,Name,Source,RollNumber,ImagePath")] Monster monster)
        {
            if (ModelState.IsValid)
            {
                monster.ImagePath = monster.Name + ".jpg";
                _context.Add(monster);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(monster));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("ID,DMName,PlayerLevel,PlayerQty")] Session session)
        {
            if (ModelState.IsValid)
            {
                int CR = session.PlayerLevel * session.PlayerQty;
                if (CR == 28)
                {
                    session.MonsterCRID = 1;
                }
                _context.Add(session);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Details", "Sessions", new { id = session.ID }));
            }
            return(View(session));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create(int id, [Bind("RoomLevel,EventID,Name,SessionID,BiomeID,CRLevel,MonsterID,CurrentRoom")] Level level)
        {
            if (ModelState.IsValid)
            {
                level.SessionID = id;
                level.CRLevel   = _repo.GetCRLevel(level.SessionID, level.CRLevel);
                level.MonsterID = _repo.GetMonsterIDbyRoll(level.MonsterID, level.CRLevel);
                level.Name      = _repo.GetMonsterName(level.MonsterID);

                int RoomMove = 0;

                switch (level.RoomLevel)
                {
                case 1:
                    RoomMove = -6;
                    break;

                case 2:
                    RoomMove = -5;
                    break;

                case 3:
                    RoomMove = -4;
                    break;

                case 4:
                    RoomMove = -3;
                    break;

                case 5:
                    RoomMove = -2;
                    break;

                case 6:
                    RoomMove = -1;
                    break;

                case 7:
                    RoomMove = 1;
                    break;

                case 8:
                    RoomMove = 2;
                    break;

                case 9:
                    RoomMove = 3;
                    break;

                case 10:
                    RoomMove = 4;
                    break;

                case 11:
                    RoomMove = 5;
                    break;

                case 12:
                    RoomMove = 6;
                    break;

                default:
                    RoomMove = 0;
                    break;
                }


                level.RoomLevel = _repo.GetCurrentRoomNumber(level.SessionID) + RoomMove;

                //Edit DB Session Current Room
                _repo.UpdateCurrentRoomNumber(level.SessionID, level.RoomLevel);

                _context.Add(level);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Details", "Sessions", new { id = level.SessionID }));
            }
            return(View(level));
        }