public async Task <ActionResult <TreeFamily> > PostTreeFamily(TreeFamily treeFamily) { _context.Trees.Add(treeFamily); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTreeFamily", new { id = treeFamily.Id }, treeFamily)); }
public async Task <IActionResult> PutTreeFamily(Guid id, TreeFamily treeFamily) { if (id != treeFamily.Id) { return(BadRequest()); } _context.Entry(treeFamily).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TreeFamilyExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }