public async Task <IActionResult> PutTypeofnew(int id, Typeofnew typeofnew) { if (id != typeofnew.Id) { return(BadRequest()); } _context.Entry(typeofnew).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TypeofnewExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Typeofnew> > PostTypeofnew(Typeofnew typeofnew) { _context.Typeofnews.Add(typeofnew); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTypeofnew", new { id = typeofnew.Id }, typeofnew)); }