Exemplo n.º 1
0
        public static IActionResult GetStatusCode(ActionIntent requestIntent, bool status, object data)
        {
            switch (requestIntent)
            {
            case ActionIntent.Get:
                return(new JsonResult(data));

            case ActionIntent.Login:
                return(status ? (IActionResult) new OkResult() : new UnauthorizedResult());

            case ActionIntent.Update:
                return(status ? (IActionResult) new CreatedResult(string.Empty, AppConstants.JsonResultOkText)
                        : new NoContentResult());

            case ActionIntent.Save:
                return(status ? (IActionResult) new CreatedResult(string.Empty, AppConstants.JsonResultOkText) :
                       new NoContentResult());

            case ActionIntent.Delete:
                return(status ? new StatusCodeResult(204) : new NotFoundResult());

            default:
                return(new OkResult());
            }
        }
Exemplo n.º 2
0
 public void UseActionIntent(ActionIntent actionIntent)
 {
     if (HasActionIntent(actionIntent))
     {
         this.actionIntent ^= actionIntent;
     }
 }
Exemplo n.º 3
0
 public GameAction(string action, ActionIntent intent, int score)
 {
     this.Action = action;
     this.Intent = intent;
     this.Score  = score;
 }
Exemplo n.º 4
0
 public bool HasActionIntent(ActionIntent actionIntent)
 {
     return((this.actionIntent & actionIntent) != 0);
 }
Exemplo n.º 5
0
 public void AddActionIntent(ActionIntent actionIntent)
 {
     this.actionIntent |= actionIntent;
 }