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")); }
// GET: FlightTravelClasses public ActionResult DisplayClass() { int flightId = Convert.ToInt32(TempData["FlightId"]); IEnumerable <FlightTravelClass> TravelClass = FlightBL.DisplayClass(flightId); return(View(TravelClass)); }
protected void FillData() { DataTable dataTable = FlightBL.ViewFlightDetails(); idFlightView1.DataSource = dataTable; idFlightView1.DataBind(); }
protected void FlightView_RowDeleting(object sender, GridViewDeleteEventArgs e) { int id = Convert.ToInt16(idFlightView1.DataKeys[e.RowIndex].Values["flightId"].ToString()); FlightBL.DeleteFlight(id); FillData(); }
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 }
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")); }
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(); }
// 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)); }
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(); }
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)); }
// 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)); }
// 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 }
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) }
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) }
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 }
protected void Insert(object sender, EventArgs e) { FlightBL.InsertFlight(txtFlightName.Text, txtFlightNumber.Text); FillData(); }