예제 #1
0
        public async Task <IActionResult> Create([Bind("BreweryName,Location")] Brewery brewery)
        {
            if (!_common.BreweryExists(brewery.Id))
            {
                if (ModelState.IsValid)
                {
                    _context.Add(brewery);
                    await _context.SaveChangesAsync();

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