コード例 #1
0
        public async Task <IActionResult> Create([Bind("Id,Name,BornDate,RegistryDate")] Person person)
        {
            if (ModelState.IsValid)
            {
                _context.Add(person);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(person));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,DocumentType,Name,Number,Validity,DocumentLocale")] Document document)
        {
            if (ModelState.IsValid)
            {
                _context.Add(document);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(document));
        }
コード例 #3
0
 public async Task InsertAsync(City obj)
 {
     _context.Add(obj);
     await _context.SaveChangesAsync();
 }