예제 #1
0
        public async Task <IActionResult> Edit(string id, [Bind("HallName,ImageUrl,Description,PhoneNumber,Adress,Town,IsDeleted,DeletedOn,Id,CreatedOn,ModifiedOn")] GamingHall gamingHall)
        {
            if (id != gamingHall.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(gamingHall);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GamingHallExists(gamingHall.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(gamingHall));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("HallName,ImageUrl,Description,PhoneNumber,Adress,Town,IsDeleted,DeletedOn,Id,CreatedOn,ModifiedOn")] GamingHall gamingHall)
        {
            if (ModelState.IsValid)
            {
                _context.Add(gamingHall);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(gamingHall));
        }
예제 #3
0
        public async Task AddAsync(string hallName, string imageUrl, string description, string phoneNumber, string adress, string town, string userId)
        {
            var gamingHall = new GamingHall();

            gamingHall.HallName = hallName;

            if (imageUrl == null)
            {
                imageUrl = GlobalConstants.DefaultLogo;
            }

            gamingHall.ImageUrl    = imageUrl;
            gamingHall.Description = description;
            gamingHall.PhoneNumber = phoneNumber;
            gamingHall.Adress      = adress;
            gamingHall.Town        = town;

            await this.repository.AddAsync(gamingHall);

            await this.repository.SaveChangesAsync();

            await this.usersHallsService.AddHallToUserAsync(userId, gamingHall.Id);
        }