Guest User

Untitled

a guest
Oct 17th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Linq;
  5. using Entity;
  6. using Dapper;
  7. using Constans.DBRepo;
  8.  
  9. namespace DB.Repository
  10. {
  11. public class PersonRepository : IPersonRepository
  12. {
  13.  
  14. string connectionStringArek =@”Data Source=ACER\MSSQLSERVER2016;Initial Catalog=Arek;Integrated Security=true”;
  15. public IDbConnection Connection = null;
  16. // get
  17. // {
  18. // return
  19. // new SqlConnection(connectionStringArek);
  20. // }
  21. //}
  22. public PersonRepository(IDbConnection connection)
  23. {
  24.  
  25. this.Connection = connection;
  26. }
  27.  
  28. public void Add(Person item)
  29. {
  30. throw new NotImplementedException();
  31. }
  32.  
  33. public void Delete(Guid id)
  34. {
  35. throw new NotImplementedException();
  36. }
  37.  
  38. public Person FindById(Guid id)
  39. {
  40. throw new NotImplementedException();
  41. }
  42.  
  43. public Person FindByUserID(int personID)
  44. {
  45. var person = new Person();
  46. using (IDbConnection con = Connection)
  47. {
  48. if (con.State == ConnectionState.Closed)
  49. con.Open();
  50. var personQuery = con.Query(PersonQuery.getPersonByID, new { PersonID = personID }).FirstOrDefault();
  51. person = personQuery;
  52. }
  53. return person;
  54. }
  55.  
  56. public IEnumerable GetAll()
  57. {
  58. throw new NotImplementedException();
  59. }
  60.  
  61. public void Remove(Person item)
  62. {
  63. throw new NotImplementedException();
  64. }
  65.  
  66. public void Update(Person item)
  67. {
  68. throw new NotImplementedException();
  69. }
  70. }
  71. }
Add Comment
Please, Sign In to add comment