// Create New Country. public long CreateNewCountry(LoginToken <Administrator> token, Country country) { long newId = 0; if (UserIsValid(token)) { newId = _countryDAO.Add(country); } return(newId); }
/// <summary> /// Method to save (add/edit) country object /// </summary> /// <param name="country"></param> /// <returns></returns> public bool SaveCountry(ADMCountry country) { try { country.ModifiedDate = System.DateTime.Now; if (country.CountryID == 0) { return(_CountryDAOLinq.Add(country)); } else { return(_CountryDAOLinq.Edit(country, true)); } } catch (Exception ex) { return(false); } }
public void Add() { countryDAO.Add(new Country("Israel")); airlineDAO.Add(new AirlineCompany("ElAl", "ElAl2004", "123456", countryDAO.GetCountryByName("Israel").ID)); Assert.AreEqual("ElAl", airlineDAO.GetAirlineByName("ElAl").AirLineName); Assert.AreEqual("ElAl2004", airlineDAO.GetAirlineByName("ElAl").UserName); Assert.AreEqual("123456", airlineDAO.GetAirlineByName("ElAl").Password); Assert.AreEqual(countryDAO.GetCountryByName("Israel").ID, airlineDAO.GetAirlineByName("ElAl").CountryCode); }
public void Add() { countryDAO.Add(new Country("Israel")); Assert.AreEqual(1, countryDAO.GetAll().Count); Assert.AreEqual("Israel", countryDAO.GetAll()[0].CountryName); }
public void Add() { countryDAO.Add(new Country("Israel")); Country israel = countryDAO.GetCountryByName("Israel"); airlineDAO.Add(new AirlineCompany("ELAL", "USERNAME", "PASSWORD", israel.ID)); AirlineCompany elal = airlineDAO.GetAirlineByName("ELAL"); flightDAO.Add(new Flight(elal.ID, israel.ID, israel.ID, new DateTime((DateTime.Now.Year + 2), 12, 5, 14, 00, 00), new DateTime((DateTime.Now.Year + 2), 12, 7, 14, 00, 00), 50, FlightStatus.NotDeparted)); Assert.AreEqual(1, flightDAO.GetAll().Count); }
public void Add() { Customer theCustomer = new Customer("FIRSTNAME", "LASTNAME", "USERNAME", "PASSWORD", "ADDRESS", "PHNUMBER", "CRDNUMBER"); customerDAO.Add(theCustomer); theCustomer = customerDAO.GetAll()[0]; Country israel = new Country("Israel"); countryDAO.Add(israel); israel = countryDAO.GetAll()[0]; AirlineCompany elal = new AirlineCompany("ELAL", "ELALUSERNAME", "ELALPASSWORD", israel.ID); airlineDAO.Add(elal); elal = airlineDAO.GetAll()[0]; Flight theFlight = new Flight(elal.ID, israel.ID, israel.ID, new DateTime((DateTime.Now.Year + 2), 12, 5, 14, 00, 00), new DateTime((DateTime.Now.Year + 2), 12, 7, 14, 00, 00), 50, FlightStatus.NotDeparted); flightDAO.Add(theFlight); theFlight = flightDAO.GetAll()[0]; ticketDAO.Add(new Ticket(theFlight.ID, theCustomer.ID)); Assert.AreEqual(1, ticketDAO.GetAll().Count); }