public bool Add(CustomerContractsModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            using (_context)
            {
                this._customer = ModelConverterHelper.GetModelFromContract(model);
                this._context.Customer.Add(this._customer);
            }

            return(true);
        }
        public bool Save(FlightContractsModel flight)
        {
            if (flight == null)
            {
                throw new ArgumentNullException(nameof(flight));
            }

            using (_context)
            {
                this._flight = this._context.Flight.FirstOrDefault(x => x.Id == flight.Id);
                this._flight = ModelConverterHelper.GetModelFromContract(flight);
                this._context.SaveChanges();
            }

            return(true);
        }
        public bool Add(FlightContractsModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            using (_context)
            {
                this._flight = ModelConverterHelper.GetModelFromContract(model);
                this._context.Flight.Add(_flight);
                this._context.SaveChanges();
            }

            return(true);
        }
Exemplo n.º 4
0
        public bool Save(GateContractsModel gate)
        {
            if (gate == null)
            {
                throw new ArgumentNullException(nameof(gate));
            }

            using (_context)
            {
                this._gate = this._context.Gate.FirstOrDefault(x => x.Id == gate.Id);
                this._gate = ModelConverterHelper.GetModelFromContract(gate);
                this._context.SaveChanges();
            }

            return(true);
        }
        public bool Save(CustomerContractsModel customer)
        {
            if (customer == null)
            {
                throw new ArgumentNullException(nameof(customer));
            }

            this._customer = ModelConverterHelper.GetModelFromContract(customer);

            using (_context)
            {
                var customerModel = _context.Customer.FirstOrDefault(x => x.Id == this._customer.Id);
                customerModel = _customer;
                _context.SaveChanges();
            }

            return(true);
        }