public ActionResult DeleteConfirmed(long id)
        {
            var aircraft = new Models.Aircraft();
            if (aircraft.Seleccionar(id))
            {
                String mensaje = aircraft.Eliminar();
                TempData["shortMessage"] = mensaje;
            }

            return RedirectToAction("Index", new { pagina = 1 });
        }
 /// <summary>
 /// GET /Aircraft/Details/5
 /// </summary>
 public ActionResult Details(long id)
 {
     var aircraft = new Models.Aircraft();
     if (aircraft.Seleccionar(id))
     {
         return View(aircraft);
     }
     else
     {
         return HttpNotFound();
     }
 }
예제 #3
0
        public ActionResult ManageAircraft()
        {
            Models.Aircraft        oAircraft   = new Models.Aircraft();
            List <Models.Aircraft> lstAircraft = null;

            if (ModelState.IsValid)
            {
                lstAircraft = oAircraft.GetAircraftInformation(0, "ALL");
            }
            ViewBag.AircraftList = lstAircraft;
            return(View());
        }
예제 #4
0
        public ActionResult ViewAircraft(Int64 nAircraftID)
        {
            Models.Aircraft        oAircraft   = new Models.Aircraft();
            List <Models.Aircraft> lstAircraft = null;

            if (ModelState.IsValid)
            {
                lstAircraft = oAircraft.GetAircraftInformation(nAircraftID, "ONE");
                if (lstAircraft != null && lstAircraft.Count > 0)
                {
                    oAircraft = lstAircraft[0];
                }
            }
            ViewBag.UserID = nAircraftID;
            return(View(oAircraft));
        }
예제 #5
0
        public ActionResult ViewAircraft(Models.Aircraft oAircraft)
        {
            string sTask = string.Empty;

            try
            {
                if (ModelState.IsValid)
                {
                    int nStatus;
                    if (oAircraft.AircraftTypeID == 0)
                    {
                        nStatus = oAircraft.InsertUpdateDeleteAircraft(oAircraft, "NEW");
                    }
                    else
                    {
                        nStatus = oAircraft.InsertUpdateDeleteAircraft(oAircraft, "EDIT");
                    }
                    switch (nStatus)
                    {
                    case -1: ViewBag.Message = "Aircraft information already exists";
                        break;

                    case 0: ViewBag.Message = "Aircraft information registerd successfully";
                        break;

                    case 1: ViewBag.Message = "Error";
                        break;

                    case 2: ViewBag.Message = "Aircraft information updated successfully";
                        break;
                    }
                }
            }
            catch (Exception)
            {
            }
            return(View());
        }
 /// <summary>
 /// GET /Aircraft/pagina
 /// </summary>
 public ActionResult Index(int pagina)
 {
     if (TempData["shortMessage"] != null)
     {
         @ViewBag.Message = TempData["shortMessage"].ToString();
     }
     var aircrafts = new Models.Aircraft().Todos(10, pagina);
     return View(aircrafts);
 }
예제 #7
0
        public ActionResult Delete(Int64 nID, string sType, string sActionName, string sControllerName)
        {
            string Message = string.Empty;

            try
            {
                if (ModelState.IsValid)
                {
                    int nStatus = 0;
                    if (nID != 0)
                    {
                        switch (sType)
                        {
                        case "User":
                        {
                            Models.User oUser = new Models.User();
                            nStatus = oUser.DeleteUser(nID, "DELETE");
                            if (oUser != null)
                            {
                                oUser.Dispose();
                                oUser = null;
                            }
                            break;
                        }

                        case "Aircraft":
                        {
                            Models.Aircraft oAircraft = new Models.Aircraft();
                            nStatus = oAircraft.DeleteAircraft(nID, "DELETE");
                            if (oAircraft != null)
                            {
                                oAircraft.Dispose();
                                oAircraft = null;
                            }
                            break;
                        }

                        case "Airline":
                        {
                            Models.Airline oAirline = new Models.Airline();
                            nStatus = oAirline.DeleteAirline(nID, "DELETE");
                            if (oAirline != null)
                            {
                                oAirline.Dispose();
                                oAirline = null;
                            }
                            break;
                        }

                        case "BME": { break; }

                        case "Stand": { break; }

                        case "Assocciation": { break; }
                        }
                    }
                    switch (nStatus)
                    {
                    case -1: ViewBag.Message = sType + " information already exists";
                        break;

                    case 1: ViewBag.Message = "Error";
                        break;

                    case 3: ViewBag.Message = sType + " information deleted successfully";
                        break;
                    }
                }
                ViewBag.Action         = sActionName;
                ViewBag.ControllerName = sControllerName;
            }
            catch (Exception ex)
            {
            }
            return(View());
        }