public async Task <IActionResult> Edit(int id, [Bind("Id,LastModifiedBy,CreatedDate,ModifiedDate,Name")] Gctype gctype) { if (id != gctype.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(gctype); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GctypeExists(gctype.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(gctype)); }
public async Task <IActionResult> PutGctype([FromRoute] int id, [FromBody] Gctype gctype) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != gctype.Id) { return(BadRequest()); } _context.Entry(gctype).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GctypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create([Bind("Id,LastModifiedBy,CreatedDate,ModifiedDate,Name")] Gctype gctype) { if (ModelState.IsValid) { _context.Add(gctype); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(gctype)); }
public async Task <IActionResult> PostGctype([FromBody] Gctype gctype) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Gctype.Add(gctype); await _context.SaveChangesAsync(); return(CreatedAtAction("GetGctype", new { id = gctype.Id }, gctype)); }