Exemple #1
0
        public async Task <IActionResult> GetById(Guid id)
        {
            var query  = new CartGetByIdQuery(id);
            var result = await Bus.RequestAsync(query);

            return(Result(HttpStatusCode.OK, result));
        }
Exemple #2
0
        public AbstractApiResult GetById(string id)
        {
            var query  = new CartGetByIdQuery(id);
            var result = Bus.Request(query);

            if (NotificationHandler.HasNotifications())
            {
                return(ValidationErrorResult());
            }

            return(result.Success
                ? (AbstractApiResult) new SuccessApiResult(HttpStatusCode.OK, result.Data)
                : (AbstractApiResult) new FailureApiResult(HttpStatusCode.BadRequest, result.Message));
        }