Exemplo n.º 1
0
        public IHttpActionResult Get(Guid tripId)
        {
            try
            {
                using (var uow = new GetTrip(null, tripId))
                {
                    var uowResult = uow.Execute();

                    switch (uowResult.Status)
                    {
                    case UnitOfWork.UnitOfWorkStatus.Ok:
                        return(Ok(uowResult.Result));

                    case UnitOfWork.UnitOfWorkStatus.NotFound:
                        return(NotFound());

                    case UnitOfWork.UnitOfWorkStatus.Forbidden:
                        return(StatusCode(HttpStatusCode.Forbidden));

                    default:
                        return(InternalServerError());
                    }
                }
            }
            catch (Exception)
            {
                return(InternalServerError());
            }
        }
Exemplo n.º 2
0
        public IHttpActionResult Get(Guid tripId)
        {
            try
            { 
                using (var uow = new GetTrip(null, tripId))
                    {
                        var uowResult = uow.Execute();

                        switch (uowResult.Status)
                        {
                            case UnitOfWork.UnitOfWorkStatus.Ok:
                                return Ok(uowResult.Result);

                            case UnitOfWork.UnitOfWorkStatus.NotFound:
                                return NotFound();

                            case UnitOfWork.UnitOfWorkStatus.Forbidden:
                                return  StatusCode(HttpStatusCode.Forbidden);
                            
                            default:
                                return InternalServerError();
                        }
                    }
                 
            }
            catch (Exception)
            {          
                return InternalServerError();
            }
        }
Exemplo n.º 3
0
        public IHttpActionResult Get(Guid tripId)
        {
            try
            {
                string ownerId = TokenIdentityHelper.GetOwnerIdFromToken();

                using (var uow = new GetTrip(ownerId, tripId))
                {
                    var uowResult = uow.Execute();

                    switch (uowResult.Status)
                    {
                    case UnitOfWork.UnitOfWorkStatus.Ok:
                        return(Ok(uowResult.Result));

                    case UnitOfWork.UnitOfWorkStatus.NotFound:
                        return(NotFound());

                    case UnitOfWork.UnitOfWorkStatus.Forbidden:
                        return(StatusCode(HttpStatusCode.Forbidden));

                    default:
                        return(InternalServerError());
                    }
                }
            }
            catch (Exception)
            {
                return(InternalServerError());
            }
        }