public async Task <IActionResult> PutWorkstream(int id, Workstream workstream) { if (id != workstream.Id) { return(BadRequest()); } _context.Entry(workstream).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WorkstreamExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Workstream> > PostWorkstream(Workstream workstream) { _context.Workstreams.Add(workstream); await _context.SaveChangesAsync(); return(CreatedAtAction("GetWorkstream", new { id = workstream.Id }, workstream)); }
private bool CreateFakeData() { var myOrganisation = new Organisation() { Name = "MDSAS" }; _context.Organisations.Add(myOrganisation); var myWorkStream = new Workstream() { Name = "Test", Organisation = myOrganisation, Active = true, Owner = "Paul" }; _context.Workstreams.Add(myWorkStream); var myProduct = new Product() { Active = true, Name = "Test Product", Workstream = myWorkStream, productType = ProductType.Website }; _context.Products.Add(myProduct); var myProject = new Project() { Active = true, Name = "Test Project", // Product = myProduct, }; _context.Projects.Add(myProject); _context.SaveChanges(); return(true); }