コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("RatingsTableId,BarOwnerId,DrinkEnthusiastId,CustomerRating")] RatingsTable ratingsTable)
        {
            if (id != ratingsTable.RatingsTableId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _db.Update(ratingsTable);
                    await _db.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RatingsTableExists(ratingsTable.RatingsTableId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(ratingsTable));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("RatingsTableId,BarOwnerId,DrinkEnthusiastId,CustomerRating")] RatingsTable ratingsTable)
        {
            if (ModelState.IsValid)
            {
                _db.Add(ratingsTable);
                await _db.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(ratingsTable));
        }