public async Task <ActionResult <Mermas> > PostMermas(Mermas mermas) { _context.Mermas.Add(mermas); await _context.SaveChangesAsync(); return(CreatedAtAction("GetMermas", new { id = mermas.IdMerma }, mermas)); }
public async Task <IActionResult> PutMermas(int id, Mermas mermas) { if (id != mermas.IdMerma) { return(BadRequest()); } _context.Entry(mermas).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MermasExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Mermas> > GetMermas(int id) { Mermas mermas = await _context.Mermas.FindAsync(id); if (mermas == null) { return(NotFound()); } return(mermas); }
public void Put(int id, [FromBody] Mermas newObj) { var oldObj = db.Mermas.Find(id); if (oldObj == null) { return; } newObj.Id = oldObj.Id; db.Entry(oldObj).CurrentValues.SetValues(newObj); db.SaveChanges(); }
public async Task <ActionResult <Mermas> > DeleteMermas(int id) { Mermas mermas = await _context.Mermas.FindAsync(id); if (mermas == null) { return(NotFound()); } _context.Mermas.Remove(mermas); await _context.SaveChangesAsync(); return(mermas); }
public void Post(Mermas sync) { db.Mermas.Add(sync); db.SaveChanges(); }