Ejemplo n.º 1
0
 public IHttpActionResult UpdateUser(User user)
 {
     try
     {
         mng.Update(user);
         apiResp.Message = "Executed";
         return(Ok(apiResp));
     }
     catch (BussinessException bex)
     {
         var MessageManage = new ApplicationMessageManagement();
         MessageManage.Create(bex.AppMessage);
         return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                  + bex.AppMessage.Message)));
     }
     catch (Exception ex)
     {
         ApplicationMessage msg = new ApplicationMessage
         {
             Message = ex.Message
         };
         var MessageManage = new ApplicationMessageManagement();
         MessageManage.Create(msg);
         return(InternalServerError(new Exception(ex.Message)));
     }
 }
Ejemplo n.º 2
0
 public IHttpActionResult GetAirlinesByAirportId(string airportId)
 {
     try
     {
         var airlineManagement = new AirlineManagement();
         apiResp = new ApiResponse
         {
             //Data = airlineManagement.GetAirlinesByAirportId(airportId),
             Message = "Action was executed."
         };
         return(Ok(apiResp));
     }
     catch (BussinessException bex)
     {
         var MessageManage = new ApplicationMessageManagement();
         MessageManage.Create(bex.AppMessage);
         return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                  + bex.AppMessage.Message)));
     }
     catch (Exception ex)
     {
         ApplicationMessage msg = new ApplicationMessage
         {
             Message = ex.Message
         };
         var MessageManage = new ApplicationMessageManagement();
         MessageManage.Create(msg);
         return(InternalServerError(new Exception(ex.Message)));
     }
 }
Ejemplo n.º 3
0
        public IHttpActionResult Put(UserHistory userHistory)
        {
            try
            {
                apiResp = new ApiResponse();
                var mng = new UserHistoryManager();
                mng.Update(userHistory);

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Ejemplo n.º 4
0
        public IHttpActionResult Post(AirportManager manager)
        {
            try
            {
                var CorreoElectronico = manager.Email;
                var pass = manager.Password;
                mng.Create(manager);
                string Mensaje = "Estimado " + manager.FirstName + "  " + manager.LastName + " <br/><br/> " + "Su contraseña de inicio es: " + pass;
                ToolsHelper.SendMail(CorreoElectronico, "Confirmación de cuenta", Mensaje);
                apiResp = new ApiResponse
                {
                    Message = "Action was executed"
                };

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Ejemplo n.º 5
0
 public IHttpActionResult GetGeneralReport(string airportId)
 {
     try
     {
         var generalReportManager = new GeneralReportManager();
         var apiResponse          = new ApiResponse
         {
             Message = "Executed",
             Data    = generalReportManager.RetrieveReport(airportId)
         };
         return(Ok(new { Result = apiResponse }));
     }
     catch (BussinessException bex)
     {
         var MessageManage = new ApplicationMessageManagement();
         MessageManage.Create(bex.AppMessage);
         return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                  + bex.AppMessage.Message)));
     }
     catch (Exception ex)
     {
         ApplicationMessage msg = new ApplicationMessage
         {
             Message = ex.Message
         };
         var MessageManage = new ApplicationMessageManagement();
         MessageManage.Create(msg);
         return(InternalServerError(new Exception(ex.Message)));
     }
 }
Ejemplo n.º 6
0
        public IHttpActionResult Get()
        {
            try
            {
                apiResp.Data = mng.RetrieveAll();

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Ejemplo n.º 7
0
        public IHttpActionResult Get(string id)
        {
            try
            {
                var airportManager = new AirportManager
                {
                    ID = id
                };

                airportManager = mng.RetrieveById(airportManager);
                apiResp.Data   = airportManager;
                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Ejemplo n.º 8
0
        public IHttpActionResult UpdateAirport(Airport airport)
        {
            try
            {
                var mng = new AirportManagement();
                mng.Update(airport);

                apiResp = new ApiResponse
                {
                    Message = "Action was executed."
                };

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Ejemplo n.º 9
0
        public IHttpActionResult RemoveAirportManager(AirportManager manager)
        {
            try
            {
                mng.Delete(manager);
                apiResp = new ApiResponse
                {
                    Message = "Action was exectued."
                };

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Ejemplo n.º 10
0
        public IHttpActionResult GetPossibleDestinyAirports(RequestAirlineAirport rqaa)
        {
            try
            {
                var mng = new AirportManagement();

                apiResp      = new ApiResponse();
                apiResp.Data = mng.RetrievePossibleDestinyAirports(rqaa);

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Ejemplo n.º 11
0
        public IHttpActionResult GetGates(string id)
        {
            try
            {
                var mng     = new AirportManagement();
                var airport = new Airport
                {
                    ID = id
                };

                List <Gate> list = mng.RetrieveGates(airport);
                apiResp      = new ApiResponse();
                apiResp.Data = list;
                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Ejemplo n.º 12
0
        public IHttpActionResult Get(string Id)
        {
            try
            {
                var mng    = new FlightManagement();
                var flight = new Flight
                {
                    Id = Id
                };

                flight       = mng.RetrieveById(flight);
                apiResp      = new ApiResponse();
                apiResp.Data = flight;
                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Ejemplo n.º 13
0
        public IHttpActionResult Get(string id)
        {
            try
            {
                var mng   = new StoreManagement();
                var store = new Store
                {
                    IDStore = id
                };

                store        = mng.RetrieveById(store);
                apiResp      = new ApiResponse();
                apiResp.Data = store;
                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Ejemplo n.º 14
0
        public IHttpActionResult getAirlinesWaiting(string id)
        {
            try
            {
                var mng     = new AirlineManagement();
                var airline = new Airline
                {
                    Id = id
                };
                apiResp      = new ApiResponse();
                apiResp.Data = mng.RetrieveWaitingAirlines(airline);

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Ejemplo n.º 15
0
        public IHttpActionResult GetCanceled()
        {
            try
            {
                apiResp = new ApiResponse();
                var mng = new FlightManagement();
                apiResp.Data = mng.flightsCanceled();

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Ejemplo n.º 16
0
        public IHttpActionResult GetAirlineAdminByAirlineId(string ID)
        {
            try
            {
                var AirlineManager = new AirlineManager
                {
                    ID = ID
                };

                AirlineManager = mng.RetrieveAirlineAdminByAirlineId(AirlineManager);
                apiResp.Data   = AirlineManager;
                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Ejemplo n.º 17
0
        public IHttpActionResult UpdateAndSendEmailRejected(AirlineManager manager)
        {
            try
            {
                var CorreoElectronico = manager.Email;
                var pass = manager.Password;
                mng.Update(manager);
                string Mensaje = "Estimado " + manager.FirstName + "  " + manager.LastName + " lamentamos informarle que su aerolínea ha sido rechazada por nuestra administración";
                ToolsHelper.SendMail(CorreoElectronico, "Denegación de cuenta", Mensaje);
                apiResp = new ApiResponse
                {
                    Message = "Action was executed."
                };

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Ejemplo n.º 18
0
 public IHttpActionResult CheckIfUserExists(string userName)
 {
     try
     {
         apiResp.Data = mng.CheckIfUserExists(userName);
         return(Ok(apiResp));
     }
     catch (BussinessException bex)
     {
         var MessageManage = new ApplicationMessageManagement();
         MessageManage.Create(bex.AppMessage);
         return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                  + bex.AppMessage.Message)));
     }
     catch (Exception ex)
     {
         ApplicationMessage msg = new ApplicationMessage
         {
             Message = ex.Message
         };
         var MessageManage = new ApplicationMessageManagement();
         MessageManage.Create(msg);
         return(InternalServerError(new Exception(ex.Message)));
     }
 }
Ejemplo n.º 19
0
        public IHttpActionResult Delete(string id)
        {
            try
            {
                var store = new Store
                {
                    IDStore = id
                };

                var mng = new StoreManagement();
                mng.Delete(store);

                apiResp = new ApiResponse
                {
                    Message = "Action was executed."
                };

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }
Ejemplo n.º 20
0
        public IHttpActionResult UpdatePassAirportAdmin(User user)
        {
            try
            {
                var mng = new LoginManager();

                mng.RecoverPasswordAdminAirline(user);
                var    CorreoElectronico = user.Email;
                var    pass    = user.Password;
                string Mensaje = "Hola" + user.FirstName + " Se ha reiniciado su contraseña <br/><br/> " + pass + " es su nueva contraseña para ingresar";
                ToolsHelper.SendMail(CorreoElectronico, "Nueva contraseña de ingreso", Mensaje);

                apiResp = new ApiResponse
                {
                    Message = "Action was executed."
                };

                return(Ok(apiResp));
            }
            catch (BussinessException bex)
            {
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(bex.AppMessage);
                return(InternalServerError(new Exception(bex.ExceptionId + "-"
                                                         + bex.AppMessage.Message)));
            }
            catch (Exception ex)
            {
                ApplicationMessage msg = new ApplicationMessage
                {
                    Message = ex.Message
                };
                var MessageManage = new ApplicationMessageManagement();
                MessageManage.Create(msg);
                return(InternalServerError(new Exception(ex.Message)));
            }
        }