public async Task <IActionResult> Edit(Guid id, [Bind("Id,Nome")] PostoColeta postoColeta) { if (id != postoColeta.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(postoColeta); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PostoColetaExists(postoColeta.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(postoColeta)); }
public async Task <IActionResult> Create([Bind("Id,Nome")] PostoColeta postoColeta) { if (ModelState.IsValid) { postoColeta.Id = Guid.NewGuid(); _context.Add(postoColeta); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(postoColeta)); }
public async Task AddAsync(PostoColeta PostoColeta) => await _context.PostosColeta.AddAsync(PostoColeta);