public IActionResult Post([FromBody] Pack pack) { IActionResult result; Drawing value = new(pack); if (pack != null) { this.logger.LogInformation("Post Drawing id {0}", value.DrawingId); try { this.repository.Add(value); // Start thread to create drawing DoDrawing.Start(value.DrawingId, this.repository); result = this.CreatedAtRoute("GetDrawing", new { id = value.DrawingId }, value); } catch (Exception) { result = this.StatusCode((int)HttpStatusCode.Conflict); } } else { result = this.BadRequest(); } return(result); }
public void TestStart() { Drawing value = new(this.pack); this.drawingId = value.DrawingId; this.repository.Add(value); DoDrawing.Start(this.drawingId, this.repository); var drawing = this.repository.Find(this.drawingId); Assert.IsTrue(drawing.Computed); Assert.AreEqual(2, drawing.Shapes.Count); }