public async Task <IActionResult> Edit(int id, [Bind("Id,Emri,Mbiemri,NumriPersonal,Adresa,DataLindjes")] Personi personi) { if (id != personi.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(personi); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersoniExists(personi.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(personi)); }
public async Task <ActionResult <Personi> > PostPersoni(Personi personi) { _context.Personi.Add(personi); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPersoni", new { id = personi.Id }, personi)); }
public async Task <IActionResult> PutPersoni(int id, Personi personi) { if (id != personi.Id) { return(BadRequest()); } _context.Entry(personi).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersoniExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create([Bind("Id,Emri,Mbiemri,NumriPersonal,Adresa,DataLindjes")] Personi personi) { if (ModelState.IsValid) { _context.Add(personi); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(personi)); }