public void PushById(QuestRoom obj, int id)
        {
            var room = db.Rooms.Find(id);

            room.Name = obj.Name;
            db.SaveChanges();
        }
예제 #2
0
        public ActionResult Edit(int id)
        {
            QuestRoom room = unit.QuestRooms.GetById(id);

            ViewBag.Phones = new SelectList(unit.Phones.GetAll(), "Id", "PhoneNumber", room.PhoneId);
            return(View(room));
        }
예제 #3
0
 public ActionResult Create(QuestRoom room)
 {
     if (ModelState.IsValid)
     {
         unit.QuestRooms.Add(room);
         return(RedirectToAction("Index"));
     }
     return(View());
 }
예제 #4
0
 public static void Add(QuestRoom room)
 {
     using (Model1 conn = new Model1())
     {
         room.JsonPhones = JsonConvert.SerializeObject(room.Phones);
         conn.Rooms.Add(room);
         conn.SaveChanges();
     }
 }
        public ActionResult DeleteRoom(int id)
        {
            QuestRoom r = db.QuestRooms.GetById(id);

            if (r == null)
            {
                return(HttpNotFound());
            }

            return(View("IndexRoom", r));
        }
예제 #6
0
 public ActionResult Edit(QuestRoom room)
 {
     if (ModelState.IsValid)
     {
         unit.QuestRooms.Update(room);
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View(room));
     }
 }
예제 #7
0
        public ActionResult Delete(int id)
        {
            QuestRoom room = unit.QuestRooms.GetById(id);

            if (room != null)
            {
                return(View(room));
            }
            else
            {
                return(new HttpNotFoundResult("quest room doesn't found"));
            }
        }
예제 #8
0
        public ActionResult Details(int id)
        {
            QuestRoom room = repository.QuestRooms.GetById(id);

            if (room != null)
            {
                return(View(room));
            }
            else
            {
                return(new HttpNotFoundResult("Quest room doesn't exist"));
            }
        }
예제 #9
0
        public static MvcHtmlString DisplayQuestRoom(this HtmlHelper html, QuestRoom room)
        {
            TagBuilder tagUl = new TagBuilder("ul");

            tagUl.AddCssClass("quests-list");
            TagBuilder tagLi = new TagBuilder("li");

            tagLi.AddCssClass("quest-item");
            TagBuilder tagDiv = new TagBuilder("div");

            tagDiv.AddCssClass("jumbotron");
            TagBuilder tagH1 = new TagBuilder("h1");

            tagH1.AddCssClass("display-4");
            tagH1.SetInnerText(room.Name);
            TagBuilder tagP = new TagBuilder("p");

            tagP.AddCssClass("lead");
            tagP.SetInnerText(room.Description);
            TagBuilder tagHr = new TagBuilder("hr");

            tagHr.AddCssClass("my-4");
            TagBuilder tagP2 = new TagBuilder("p");

            tagP2.SetInnerText("Duration: " + room.Description);

            tagDiv.InnerHtml += tagH1.ToString();
            tagDiv.InnerHtml += tagP.ToString();
            tagDiv.InnerHtml += tagHr.ToString();
            tagDiv.InnerHtml += tagP2.ToString();

            tagLi.InnerHtml += tagDiv.ToString();

            tagUl.InnerHtml += tagLi.ToString();


            //     < ul class="quests-list">
            //<li class="quest-item">
            //    <div class="jumbotron">
            //        <h1 class="display-4">@item.Name</h1>
            //        <p class="lead">@item.Description</p>
            //        <hr class="my-4">
            //        <p>Duration: @item.Time</p>
            //        <p class="lead">
            //            <a class="btn btn-primary btn-lg" href="/home/details/@item.Id" role="button">Learn more</a>
            //        </p>
            //    </div>
            //</li>
            // </ ul>
            return(new MvcHtmlString(tagUl.ToString()));
        }
예제 #10
0
 public ActionResult EditQuest(QuestRoom newRoom)
 {
     rep.PushById(newRoom, newRoom.ID);
     return(View("Index", rep.GetAll()));
 }
예제 #11
0
 public ActionResult AddQuest(QuestRoom newRoom)
 {
     rep.Add(newRoom);
     return(RedirectToAction("AddingRoom", "Admin"));
 }
예제 #12
0
 public void Add(QuestRoom item)
 {
     db.Rooms.Add(item);
     db.SaveChanges();
 }
예제 #13
0
 public ActionResult AddingRoom(QuestRoom newRoom)
 {
     rep.Add(newRoom);
     return(View("Index"));
 }
예제 #14
0
 public async Task AddRoomAsync(QuestRoom room)
 {
     await _roomRepository.CreateAsync(room);
 }
예제 #15
0
 public async Task EditRoomAsync(QuestRoom room)
 {
     await _roomRepository.UpdateAsync(room);
 }
예제 #16
0
        protected override void Seed(QuestContext context)
        {
            Phone phone1 = new Phone()
            {
                Number = "08003005001"
            };
            Phone phone2 = new Phone()
            {
                Number = "08003005002"
            };
            Phone phone3 = new Phone()
            {
                Number = "08003005002"
            };
            Phone phone4 = new Phone()
            {
                Number = "08003005002"
            };
            Phone phone5 = new Phone()
            {
                Number = "08003005002"
            };
            Phone phone6 = new Phone()
            {
                Number = "08003005002"
            };

            Picture picture1 = new Picture()
            {
                Path = "https://s.barraques.cat/pngfile/s/140-1406931_photo-wallpaper-house-clown-mask-halloween-halloween-killer.jpg"
            };
            Picture picture2 = new Picture()
            {
                Path = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQw5vi4swgWLFT2Ghb5R_SZcsQhf-yeQILA61ke_lNGRL7BsAq7"
            };
            Picture picture3 = new Picture()
            {
                Path = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTmtZlig0_thn8YwAd9zkj4zsUZQAL-p51ubQo8NwqgHxyT7WFT"
            };
            Picture picture4 = new Picture()
            {
                Path = "https://data.whicdn.com/images/246449584/large.jpg"
            };
            Picture picture5 = new Picture()
            {
                Path = "https://s3.reutersmedia.net/resources/r/?d=20190531&i=RCV006SUK&w=&r=RCV006SUK&t=2"
            };
            Picture picture6 = new Picture()
            {
                Path = "https://www.nationalgeographic.com/content/dam/science/2019/02/08/hidden-world/image-42-mealworm_jwn.adapt.1900.1.jpg"
            };

            QuestRoom room = new QuestRoom()
            {
                Name            = "TestRoom",
                Address         = "TestAddress",
                CompanyName     = "TestCompany",
                Description     = "TestDescription",
                Email           = "*****@*****.**",
                FearLevel       = 3,
                GameTime        = 30,
                HardLevel       = 3,
                MaxPlayersCount = 3,
                MinPlayersAge   = 20,
                MinPlayersCount = 5,
                Rate            = 0,
                Logo            = "https://www.telegraph.co.uk/content/dam/films/2016/10/31/juon3_trans_NvBQzQNjv4BqNJjoeBT78QIaYdkJdEY4CnGTJFJS74MYhNY6w3GNbO8.jpg?imwidth=450"
            };

            room.PhoneNumbers.Add(phone1);
            room.PhoneNumbers.Add(phone2);

            room.Pictures.Add(picture1);
            room.Pictures.Add(picture2);

            QuestRoom room1 = new QuestRoom()
            {
                Name            = "TestRoom1",
                Address         = "TestAddress1",
                CompanyName     = "TestCompany1",
                Description     = "TestDescription1",
                Email           = "*****@*****.**",
                FearLevel       = 3,
                GameTime        = 30,
                HardLevel       = 3,
                MaxPlayersCount = 3,
                MinPlayersAge   = 20,
                MinPlayersCount = 5,
                Rate            = 0,
                Logo            = "https://d13ezvd6yrslxm.cloudfront.net/wp/wp-content/images/IMG_3923-1-700x420.jpg"
            };

            room1.PhoneNumbers.Add(phone3);
            room1.PhoneNumbers.Add(phone4);

            room1.Pictures.Add(picture3);
            room1.Pictures.Add(picture4);

            QuestRoom room2 = new QuestRoom()
            {
                Name            = "TestRoom2",
                Address         = "TestAddress2",
                CompanyName     = "TestCompany2",
                Description     = "TestDescription2",
                Email           = "*****@*****.**",
                FearLevel       = 3,
                GameTime        = 30,
                HardLevel       = 3,
                MaxPlayersCount = 3,
                MinPlayersAge   = 20,
                MinPlayersCount = 5,
                Rate            = 0,
                Logo            = "https://drifterplanet.com/wp-content/uploads/2017/12/Cancun-Private-Beach-Party.jpg"
            };

            room2.PhoneNumbers.Add(phone5);
            room2.PhoneNumbers.Add(phone6);

            room2.Pictures.Add(picture5);
            room2.Pictures.Add(picture6);

            context.Rooms.Add(room);
            context.Rooms.Add(room1);
            context.Rooms.Add(room2);
            context.SaveChanges();
        }