public async Task <IActionResult> UpdateTarget([FromBody] StateTarget target) { try { var results = await _adminManager.UpdateTarget(target); return(Ok(results)); } catch (Exception ex) { await new RaygunClient(_settings.ApiKey).SendInBackground(ex); return(BadRequest(new { error = ex.Message })); } }
public void SetState(StateTarget newState) { if (curState != null) { //Debug.Log("Leaving State " + curState.ToString()); curState.OnLeave(); } curState = newState; if (curState != null) { curState.OnEnter(); //Debug.Log("Entering State " + curState.ToString()); } }
public async Task <OperationResult> AddTarget(StateTarget target) { var userName = "******"; var proc = "[dbo].[usp_AddStateTarget] @p0, @p1, @p2, @p3, @p4"; var results = await _context.DeleteRecord.FromSql(proc, target.TargetType, target.SchoolYear, target.TargetName, target.TargetValue, userName).ToListAsync(); var result = new OperationResult(); foreach (var res in results) { //should always be 1 row result.IsSuccessful = res.Success; result.ErrorMessages = res.Success ? null : new List <string> { "Add operation failed." }; result.UserMessages = null; result.NewId = string.Empty; break; } return(result); }