public static void Main(string[] args) { NamesRepo.Init("./csvs/dataset_names.csv"); ISO3166Repo.Init("./csvs/dataset_iso3166.csv"); SurnamesRepo.Init("./csvs/dataset_surnames.csv"); StatesRepo.Init("./csvs/dataset_us_states.csv"); CitiesRepo.Init("./csvs/dataset_us_cities.csv"); CreateHostBuilder(args).Build().Run(); }
public void GetStatesTest() { StatesRepo myStates = new StatesRepo(); var states = myStates.GetStates(); Assert.AreEqual("MN", states[0].StateAbbreviation); Assert.AreEqual("Iowa", states[1].StateName); Assert.AreEqual(5.75, states[2].TaxRate); Assert.AreEqual("ND", states[3].StateAbbreviation); Assert.AreEqual("South Dakota", states[4].StateName); }
/// <summary> /// Obtener cantidad de registros de Sancion /// Autor: Jair Guerrero /// Fecha: 2020-12-05 /// </summary> public int Count() { try { IRepository <States> repo = new StatesRepo(context); return(repo.Count()); } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }
/// <summary> /// Obtener Sancion por Id /// Autor: Jair Guerrero /// Fecha: 2020-12-05 /// </summary> public StatesAM Get(long id) { try { IRepository <States> repo = new StatesRepo(context); var sancion = repo.Get(id); return(mapper.Map <StatesAM>(sancion)); } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }
/// <summary> /// Obtener cantidad de registros de Sancion según filtro /// Autor: Jair Guerrero /// Fecha: 2020-12-05 /// </summary> public int Count(Expression <Func <StatesAM, bool> > predicate) { try { var where = mapper.MapExpression <Expression <Func <States, bool> > >(predicate); IRepository <States> repo = new StatesRepo(context); return(repo.Count(where)); } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }
/// <summary> /// Crear registro de Sancion /// Autor: Jair Guerrero /// Fecha: 2020-12-05 /// </summary> public long Create(StatesAM entity) { try { var sancion = mapper.Map <States>(entity); IRepository <States> repo = new StatesRepo(context); return(repo.Create(sancion)); } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }
/// <summary> /// Actualizar states /// Autor: Jair Guerrero /// Fecha: 2021-02-20 /// </summary> public void Update(StatesAM entity) { try { var states = mapper.Map <States>(entity); IRepository <States> repo = new StatesRepo(context); repo.Update(states); } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }
/// <summary> /// Obtener lista de states /// Autor: Jair Guerrero /// Fecha: 2021-02-20 /// </summary> public List <StatesAM> Get() { try { IRepository <States> repo = new StatesRepo(context); var states = repo.Get(); return(mapper.Map <List <StatesAM> >(states)); } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }
/// <summary> /// Obtener primera Sancion según filtro /// Autor: Jair Guerrero /// Fecha: 2020-12-05 /// </summary> public StatesAM GetFirst(Expression <Func <StatesAM, bool> > predicate) { try { var where = mapper.MapExpression <Expression <Func <States, bool> > >(predicate); IRepository <States> repo = new StatesRepo(context); var sancion = repo.GetFirst(where); return(mapper.Map <StatesAM>(sancion)); } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }
public IEnumerable <IState> GetAll() => StatesRepo.GetAll();