public async Task <ActionResult <Models.Lugat> > PostLugat(Models.Lugat lugat) { _context.Lugatlar.Add(lugat); await _context.SaveChangesAsync(); return(CreatedAtAction("GetLugat", new { id = lugat.Id }, lugat)); }
public async Task <IActionResult> PutLugat(int id, Models.Lugat lugat) { if (id != lugat.Id) { return(BadRequest()); } _context.Entry(lugat).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LugatExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }