/// <summary> /// Update one record /// </summary> /// <param name="aircraftModel"></param> /// <returns></returns> public bool UpdateOne(object aircraftModel) { this.mAircraftModel = aircraftModel as AircraftModel; DataProvidor dp = new DataProvidor(); return(dp.UpdateAircraftModel(mAircraftModel.AircraftModelID, mAircraftModel.ModelName, mAircraftModel.Description, mAircraftModel.AdditionalData, mAircraftModel.Category, mAircraftModel.EngineType, mAircraftModel.Manufacturer, mAircraftModel.ImagePath)); }
/// <summary> /// Delete One record /// </summary> /// <param name="aircraftModel"></param> public void DeleteOne(object aircraftModel) { this.mAircraftModel = aircraftModel as AircraftModel; DataProvidor dp = new DataProvidor(); dp.DeleteAircraftModel(mAircraftModel.AircraftModelID); }
/// <summary> /// Add new record /// </summary> /// <param name="aircraftModel"></param> /// <returns></returns> public int Insert(object aircraftModel) { this.mAircraftModel = aircraftModel as AircraftModel; DataProvidor dp = new DataProvidor(); return(dp.AddAircraftModel(mAircraftModel.Manufacturer.Name, mAircraftModel.Description, mAircraftModel.AdditionalData, mAircraftModel.Category.CategoryID, mAircraftModel.EngineType.WorkID, mAircraftModel.Manufacturer.ManufacturerID, mAircraftModel.ImagePath)); }
/// <summary> /// Get Data /// </summary> /// <returns></returns> public object GetData() { List <AircraftModel> result = new List <AircraftModel>(); DataProvidor dp = new DataProvidor(); foreach (DataAccess.Models.AircraftModel aircraftModel in dp.GetAircraftModelData()) { AircraftModel _aircraftMod = new AircraftModel(); _aircraftMod.AircraftModelID = aircraftModel.AircraftModelID; _aircraftMod.Category = new Category() { CategoryID = (int)aircraftModel.CategoryID, CategoryName = aircraftModel.Category.CategoryName, AdditionalData = aircraftModel.AdditionalData }; _aircraftMod.EngineType = new Maintenance() { WorkID = (int)aircraftModel.EngineType.WorkID, FlightModel = aircraftModel.EngineType.FlightModel, FlightNumber = (string)aircraftModel.FlightNumber, Description = aircraftModel.Description }; _aircraftMod.Description = aircraftModel.Description; _aircraftMod.ModelName = aircraftModel.ModelName; _aircraftMod.Manufacturer = new Manufacturer() { ManufacturerID = (string)aircraftModel.FlightNumber, Name = aircraftModel.ModelName, Description = aircraftModel.Description, AdditionalData = aircraftModel.AdditionalData }; _aircraftMod.ImagePath = aircraftModel.ImagePath; _aircraftMod.AdditionalData = aircraftModel.AdditionalData; result.Add(_aircraftMod); } return(result); }
/// <summary> /// Get Data /// </summary> /// <returns></returns> public object GetData() { List <AircraftModel> result = new List <AircraftModel>(); DataProvidor dp = new DataProvidor(); foreach (DTO.AircraftModel aircraftModel in dp.GetAircraftModelData()) { AircraftModel _aircraftMod = new AircraftModel(); _aircraftMod.AircraftModelID = aircraftModel.AircraftModelID; _aircraftMod.Category = aircraftModel.Category; _aircraftMod.EngineType = aircraftModel.EngineType; _aircraftMod.Description = aircraftModel.Description; _aircraftMod.ModelName = aircraftModel.ModelName; _aircraftMod.Manufacturer = aircraftModel.Manufacturer; _aircraftMod.ImagePath = aircraftModel.ImagePath; _aircraftMod.AdditionalData = aircraftModel.AdditionalData; result.Add(_aircraftMod); } return(result); }