You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ValuesManager.cs 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System.Collections.Generic;
  2. using System.Data.Entity;
  3. using iiie.Logs.DBO;
  4. using iiie.WebApiUtils.BusinessManager;
  5. using WebAPiUtils_test.DBO;
  6. namespace WebAPiUtils_test.DataAccess
  7. {
  8. public class ValuesManager : SqlServerManager<T_SqlManager, ValuesDboGet, ValuesDboAdd, ValuesDboEdit, SqlServerManagerEntities, ValuesManager>
  9. {
  10. public override DbSet<T_SqlManager> GetTable(SqlServerManagerEntities db)
  11. {
  12. return db.T_SqlManager;
  13. }
  14. public override ValuesDboGet DbToDboGet(T_SqlManager obj)
  15. {
  16. return new ValuesDboGet
  17. {
  18. Id = obj.id,
  19. MyInt = obj.my_int,
  20. MyString = obj.my_string,
  21. Text = obj.T_Text.text,
  22. TextId = obj.text
  23. };
  24. }
  25. public override T_SqlManager DboAddToDb(ValuesDboAdd obj)
  26. {
  27. return new T_SqlManager
  28. {
  29. my_string = obj.MyString,
  30. my_int = obj.MyInt,
  31. text = obj.TextId
  32. };
  33. }
  34. public override T_SqlManager DboEditToDb(ValuesDboEdit obj, T_SqlManager edit)
  35. {
  36. return new T_SqlManager
  37. {
  38. id = edit.id,
  39. my_string = obj.MyString,
  40. my_int = obj.MyInt,
  41. text = obj.TextId
  42. };
  43. }
  44. public static OpResult<IEnumerable<ValuesDboGet>> Contains(string text, int page, int perPage)
  45. {
  46. return GetMultiple(x => x.my_string.Contains(text), x => x.id, page, perPage);
  47. }
  48. }
  49. }