public (bool IsSucess, bool IsRefresh) Handle(string receivedData) { if (!string.IsNullOrEmpty(receivedData)) { try { var line = JsonConvert.DeserializeObject <Line>(receivedData); if (line.StrokeId != Guid.Empty && line.StartPoint != null && line.StrokeId != Guid.Empty) { //should be done async when adding to db _lineService.CreateLine(line); return(true, false); } var stroke = JsonConvert.DeserializeObject <Stroke>(receivedData); if (stroke.Id != Guid.Empty || stroke.StartPoint != null) { _strokeService.Update(stroke); return(true, true); } return(false, false); } catch (JsonException ex) { return(false, false); } } return(false, false); }
public ActionResult CreateLine(Guid strokeId, [FromBody] Line line) { line.StrokeId = strokeId; return(new JsonResult(_lineService.CreateLine(line), _serializer)); }
public IActionResult CreateLine([FromBody] LineVM lineViewModel) { return(GetResult(() => _lineService.CreateLine(lineViewModel.MapToLineModel()), r => r)); }