public ThrowModel SaveThrowModel(ThrowModel model) { var result = model; model.ValidateModel(); var throwEngine = new ThrowEngine(); var throwAccessor = new ThrowAccessor(); var betEngine = new BetEngine(); var betAccessor = new BetAccessor(); var parentBet = betAccessor.GetBetByParticipant(model.ParticipantID); using (var scope = new TransactionScope()) { var savedThrow = throwAccessor.SaveThrow(throwEngine.BuildThrow(model)); var betsToAdd = betEngine.BuildBets(savedThrow, model.RedemptionBets, parentBet.BetID); foreach (var bet in betsToAdd) { betAccessor.AddNewBetWithNewParticipants(bet); } result = throwAccessor.GetThrowModel(savedThrow.ThrowID); scope.Complete(); } return(result); }
public Throw BuildThrow(ThrowModel model) { return(new Throw() { ThrowID = model.ThrowID, ThrowTypeID = model.ThrowTypeID, ParticipantID = model.ParticipantID, Notes = model.Notes, Success = model.Success }); }
public ThrowModel GetThrowModel(int throwID) { ThrowModel result = null; using (var db = new CFLSuiteDB()) { result = db.Throws.Where(x => x.ThrowID == throwID).ToThrowModels().First(); } return(result); }
public ThrowModel DeleteThrowModel(ThrowModel model) { var result = model; using (var db = new CFLSuiteDB()) { var existing = db.Throws.First(x => x.ThrowID == model.ThrowID); db.Throws.Remove(existing); db.SaveChanges(); } return(result); }
public void Start() { if (canon == null) { canon = this.GetComponent <ThrowModel>(); } if (myAnim != null) { return; } else { myAnim = GameObject.FindObjectOfType <Animator>(); } PlayerControllerFinal.instance.On_TossNow_Sent += On_TossNow_Received; }
public Throw(ThrowModel @throw, ExecutionEngine logic) { this.create = () => { Operator message = logic.Operators.CreateFrom(@throw.Message); if (message.Expression.Type != typeof(string)) { throw new ExpressionConfigException("Exception argument must be a string"); } var exceptionType = @throw.Type.IfExists(type => logic.Operators.Models.Sources .Select(source => source.Assembly) .SelectMany(types => types.ExportedTypes) .FirstOrDefault(candidate => candidate.FullName.Contains(type) && typeof(ExpressionRuntimeException).IsAssignableFrom(candidate))) ?? typeof(ExpressionRuntimeException); var ctor = exceptionType.FindCtorAccepting(typeof(string)).Value; var ex = Expression.New(ctor, message.Expression); return(Expression.Throw(ex, typeof(string))); }; }
public ActionResult DeleteThrowModel([DataSourceRequest] DataSourceRequest req, ThrowModel model) { var result = model; try { result = new BetService().DeleteThrowModel(model); } catch (Exception e) { ModelState.AddModelError("Error", e.Message); } return(Json(new[] { result }.ToDataSourceResult(req, ModelState))); }
public ThrowModel DeleteThrowModel(ThrowModel model) { return(new ThrowAccessor().DeleteThrowModel(model)); }