//Get the details of a particular airlineoverride
 public AirlineOverride GetAirlineOverrideData(String id)
 {
     try
     {
         Guid            guid            = new Guid(id);
         AirlineOverride airlineoverride = db.AirlineOverride.Find(guid);
         return(airlineoverride);
     }
     catch
     {
         return(null);
     }
 }
 //To Update the records of a particluar airlineoverride
 public int UpdateAirlineOverride(AirlineOverride airlineoverride)
 {
     try
     {
         db.Entry(airlineoverride).State = EntityState.Modified;
         db.SaveChanges();
         return(1);
     }
     catch
     {
         return(-1);
     }
 }
 //To Add new airlineoverride record
 public int AddAirlineOverride(AirlineOverride airlineoverride)
 {
     try
     {
         db.AirlineOverride.Add(airlineoverride);
         db.SaveChanges();
         return(1);
     }
     catch
     {
         return(-1);
     }
 }
Ejemplo n.º 4
0
        public void Test2()
        {
            // Set up Prerequisites
            var controller = new AirlineOverrideApp.Controllers.AirlineOverrideController();

            AirlineOverrideApp.Models.AirlineOverride airlineoverride = new AirlineOverrideApp.Models.AirlineOverride();

            airlineoverride.Code          = "4MT";
            airlineoverride.StartDate     = new DateTime(2010, 8, 18);
            airlineoverride.EndDate       = new DateTime(2011, 8, 18);
            airlineoverride.Groupable     = true;
            airlineoverride.SelfTicketing = false;
            airlineoverride.MinRevenue    = 8;
            airlineoverride.GuaranteedRoi = 2;
            airlineoverride.PayingFrom    = 8;
            airlineoverride.Active        = true;

            int res = controller.Create(airlineoverride);

            Assert.AreEqual(-1, res);
        }
Ejemplo n.º 5
0
        public void Test4()
        {
            // Set up Prerequisites
            var controller = new AirlineOverrideApp.Controllers.AirlineOverrideController();

            AirlineOverrideApp.Models.AirlineOverride airlineoverride = new AirlineOverrideApp.Models.AirlineOverride();

            airlineoverride.AirlineOverrideId = new Guid("DC59C40E-07E7-492E-B4D6-229A9E4BD758");
            airlineoverride.Code          = "QM";
            airlineoverride.StartDate     = new DateTime(2010, 8, 18);
            airlineoverride.EndDate       = new DateTime(2011, 8, 18);
            airlineoverride.Groupable     = true;
            airlineoverride.SelfTicketing = false;
            airlineoverride.MinRevenue    = 123456789123.01M;
            airlineoverride.GuaranteedRoi = 2;
            airlineoverride.PayingFrom    = 8;
            airlineoverride.Active        = true;

            int res = controller.Edit(airlineoverride);

            Assert.AreEqual(1, res);
        }
        //To Delete the record of a particular airlineoverride
        public int DeleteAirlineOverride(string id)
        {
            try
            {
                Guid            guid            = new Guid(id);
                AirlineOverride airlineoverride = db.AirlineOverride.Find(guid);

                if (airlineoverride != null)
                {
                    var aot = db.AirlineOverrideTarget.Where(o => o.AirlineOverride.AirlineOverrideId == guid).ToList();

                    db.AirlineOverrideTarget.RemoveRange(aot);

                    db.AirlineOverride.Remove(airlineoverride);
                    db.SaveChanges();
                }
                return(1);
            }
            catch
            {
                return(-1);
            }
        }
 public int Edit(AirlineOverrideApp.Models.AirlineOverride AirlineOverride)
 {
     return(objAirlineOverride.UpdateAirlineOverride(AirlineOverride));
 }
 public int Create(AirlineOverrideApp.Models.AirlineOverride AirlineOverride)
 {
     return(objAirlineOverride.AddAirlineOverride(AirlineOverride));
 }