Ejemplo n.º 1
0
        public ActionResult DeleteClass(FlightTravelClassModel delete)
        {
            FlightTravelClass flightTravelClass = AutoMapper.Mapper.Map <FlightTravelClassModel, FlightTravelClass>(delete);     //Auto Mapper model to entity

            FlightBL.DeleteFlightTravelClass(flightTravelClass);
            return(RedirectToAction("DisplayFlight", "Flight"));
        }
Ejemplo n.º 2
0
        // GET: FlightTravelClasses
        public ActionResult DisplayClass()
        {
            int flightId = Convert.ToInt32(TempData["FlightId"]);
            IEnumerable <FlightTravelClass> TravelClass = FlightBL.DisplayClass(flightId);

            return(View(TravelClass));
        }
Ejemplo n.º 3
0
        protected void FillData()
        {
            DataTable dataTable = FlightBL.ViewFlightDetails();

            idFlightView1.DataSource = dataTable;
            idFlightView1.DataBind();
        }
Ejemplo n.º 4
0
        protected void FlightView_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int id = Convert.ToInt16(idFlightView1.DataKeys[e.RowIndex].Values["flightId"].ToString());

            FlightBL.DeleteFlight(id);
            FillData();
        }
Ejemplo n.º 5
0
        public ActionResult DeleteFlight(int Id)
        {
            Flight      flight      = FlightBL.GetFlightDetails(Id);
            FlightModel flightModel = AutoMapper.Mapper.Map <Flight, FlightModel>(flight); //Auto Mapper entity to model

            return(View(flightModel));                                                     //Calling View for the Delste Flight
        }
Ejemplo n.º 6
0
        public ActionResult DeleteFlight(FlightModel delete)
        {
            Flight flight = AutoMapper.Mapper.Map <FlightModel, Flight>(delete);     //Auto Mapper model to entity

            FlightBL.DeleteFlight(flight);
            TempData["message"] = "Flight deleted successfully";
            return(RedirectToAction("DisplayFlight"));
        }
Ejemplo n.º 7
0
        protected void FlightView_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string txtFlightName   = Convert.ToString((idFlightView1.Rows[e.RowIndex].FindControl("TxtFlightName") as TextBox).Text);
            string txtFlightNumber = Convert.ToString((idFlightView1.Rows[e.RowIndex].FindControl("TxtFlightNumber") as TextBox).Text);
            int    id = Convert.ToInt16(idFlightView1.DataKeys[e.RowIndex].Values["flightId"].ToString());

            FlightBL.UpdateFlight(id, txtFlightName, txtFlightNumber);
            FillData();
        }
Ejemplo n.º 8
0
        // GET: FlightTravelClasses/Delete/5
        public ActionResult DeleteClass(int id)
        {
            FlightTravelClass flightTravelClass = FlightBL.GetDetailsClass(id);

            ViewBag.ClassId = new SelectList(FlightBL.GetTravelClass(), "ClassId", "ClassName");
            FlightTravelClassModel delete = AutoMapper.Mapper.Map <FlightTravelClass, FlightTravelClassModel>(flightTravelClass);     //Auto Mapper entity to model

            return(View(delete));
        }
Ejemplo n.º 9
0
        protected void btnInsert_Click(object sender, EventArgs e)
        {
            string       txtFlightName   = Convert.ToString((idFlightView1.FooterRow.FindControl("txtInsertFlightName") as TextBox).Text);
            string       txtFlightNumber = Convert.ToString((idFlightView1.FooterRow.FindControl("txtInsertFlightNumber") as TextBox).Text);
            FlightEntity flightEntity    = new FlightEntity(txtFlightName, txtFlightNumber);

            FlightBL.InsertFlight(flightEntity);
            FillData();
        }
Ejemplo n.º 10
0
        public ActionResult CreateClass()
        {
            FlightTravelClass flightTravelClass = new FlightTravelClass();

            flightTravelClass.FlightId = Convert.ToInt32(TempData["FlightId"]);
            ViewBag.ClassId            = new SelectList(FlightBL.GetTravelClass(), "ClassId", "ClassName");
            FlightTravelClassModel flightTravelClassModel = AutoMapper.Mapper.Map <FlightTravelClass, FlightTravelClassModel>(flightTravelClass);     //Auto Mapper entity to model

            return(View(flightTravelClassModel));
        }
Ejemplo n.º 11
0
        // GET: FlightTravelClasses/Edit/5
        public ActionResult EditClass(int id)
        {
            FlightTravelClass         flightTravelClass = FlightBL.GetDetailsClass(id);
            IEnumerable <TravelClass> travelClass       = FlightBL.GetTravelClass();

            ViewBag.ClassId = new SelectList(travelClass, "ClassId", "ClassName");
            FlightTravelClassModel flightTravelClassModel = AutoMapper.Mapper.Map <FlightTravelClass, FlightTravelClassModel>(flightTravelClass);       //Auto Mapper entity to model

            return(View(flightTravelClassModel));
        }
Ejemplo n.º 12
0
        // GET: Flight
        public ActionResult DisplayFlight()
        {
            IEnumerable <Flight> flights      = FlightBL.DisplayFlight();
            List <FlightModel>   flightModels = new List <FlightModel>();

            foreach (var flight in flights)
            {
                FlightModel flightModel = AutoMapper.Mapper.Map <Flight, FlightModel>(flight);       //Auto Mapper entity to model
                flightModels.Add(flightModel);
            }
            return(View(flightModels));      //Calling View for the Display Flight
        }
Ejemplo n.º 13
0
 public ActionResult CreateClass(FlightTravelClassModel flightTravelClassModel)
 {
     if (ModelState.IsValid)                                                                                                   //condition pass when all the model state validation is true
     {
         FlightTravelClass create = AutoMapper.Mapper.Map <FlightTravelClassModel, FlightTravelClass>(flightTravelClassModel); //Auto Mapper model to entity
         FlightBL.CreateClass(create);
         TempData["FlightId"] = create.FlightId;
         return(RedirectToAction("DisplayFlight", "Flight"));
     }
     ViewBag.Class_Id = new SelectList(FlightBL.GetTravelClass(), "ClassId", "ClassName", flightTravelClassModel.ClassId);
     return(View(flightTravelClassModel));            //Calling View for the Create Class(when the ModelState is in valid)
 }
Ejemplo n.º 14
0
 public ActionResult EditFlight(FlightModel edit)
 {
     if (ModelState.IsValid)                                                //condition pass when all the model state validation is true
     {
         Flight flight = AutoMapper.Mapper.Map <FlightModel, Flight>(edit); //Auto Mapper model to entity
         FlightBL.UpdateFlight(flight);
         TempData["message"]  = "Flight Updated successfully";
         TempData["FlightId"] = flight.FlightId;
         return(RedirectToAction("DisplayClass", "FlightTravelClasses"));
     }
     return(View());      //Calling View for the EditFlight(when the ModelState is in valid)
 }
Ejemplo n.º 15
0
 public ActionResult EditClass(FlightTravelClassModel flightTravelClass)
 {
     if (ModelState.IsValid)                                                                                            //condition pass when all the model state validation is true
     {
         FlightTravelClass edit = AutoMapper.Mapper.Map <FlightTravelClassModel, FlightTravelClass>(flightTravelClass); //Auto Mapper model to entity
         FlightBL.EditClass(edit);
         return(RedirectToAction("DisplayFlight", "Flight"));
     }
     ViewBag.Flight_Id = new SelectList(FlightBL.DisplayFlight(), "FlightId", "FlightName", flightTravelClass.FlightId);
     ViewBag.Class_Id  = new SelectList(FlightBL.GetTravelClass(), "ClassId", "ClassName", flightTravelClass.ClassId);
     return(View(flightTravelClass));     //Calling View for the Edit Class(when the ModelState is in valid)
 }
        public ActionResult UserDisplay()
        {
            IEnumerable <Flight> flights = FlightBL.DisplayFlight();

            return(View(flights));           //Calling View for the User Flight Display
        }
Ejemplo n.º 17
0
 protected void Insert(object sender, EventArgs e)
 {
     FlightBL.InsertFlight(txtFlightName.Text, txtFlightNumber.Text);
     FillData();
 }