コード例 #1
0
        public async Task <IActionResult> Create([Bind("Id,Name,ClientId")] Site site)
        {
            if (ModelState.IsValid)
            {
                //_repostory.DbContext().Add(site);
                //await _repostory.DbContext().SaveChangesAsync();
                await _repostory.SaveAsync(site);

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

            ViewData["ClientId"] = new SelectList(_repostory.DbContext().Clients, "Id", "Id", site.ClientId);

            return(View(site));
        }