public async Task <ActionResult <Salers> > PostSalers(Salers salers) { _context.Salers.Add(salers); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSalers", new { id = salers.SalerId }, salers)); }
public async Task <IActionResult> Edit(int id, [Bind("id, Name")] Salers salers) { if (id != salers.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(salers); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SalersExists(salers.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(salers)); }
public async Task <IActionResult> PutSalers(int id, Salers salers) { if (id != salers.SalerId) { return(BadRequest()); } _context.Entry(salers).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SalersExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create([Bind("id, Name")] Salers salers) { if (ModelState.IsValid) { _context.Add(salers); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(salers)); }