public async Task <IActionResult> Create([Bind("Id,Uf,TradingName,Cnpj")] Company company) { if (!ModelState.IsValid) { return(View(company)); } if (ModelState.IsValid) { _context.Add(company); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(company)); }
public async Task InsertAsync(Purveyor obj) { obj.CreatedAt = DateTime.Now; _context.Add(obj); await _context.SaveChangesAsync(); }