您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

ValuesManager.cs 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System.Data.Entity;
  2. using iiie.Logs.DBO;
  3. using iiie.WebApiUtils.BusinessManager;
  4. using iiie.WebApiUtils.DBO;
  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 OpResult<bool> DboAddToDb(ValuesDboAdd obj, T_SqlManager add)
  26. {
  27. var res = GetSingleById(obj.TextId);
  28. if (!res)
  29. return res.To<bool>();
  30. add.my_string = obj.MyString;
  31. add.my_int = obj.MyInt;
  32. add.text = obj.TextId;
  33. return OpResult<bool>.Ok(true);
  34. }
  35. public override OpResult<bool> DboEditToDb(ValuesDboEdit obj, T_SqlManager edit)
  36. {
  37. var res = GetSingleById(obj.TextId);
  38. if (!res)
  39. return res.To<bool>();
  40. edit.my_string = obj.MyString;
  41. edit.my_int = obj.MyInt;
  42. edit.text = obj.TextId;
  43. return OpResult<bool>.Ok(true);
  44. }
  45. public static OpResult<DboGetMultiple<ValuesDboGet>> Contains(string text, int page, int perPage)
  46. {
  47. return GetMultiple(x => x.my_string.Contains(text), x => x.id, page, perPage);
  48. }
  49. }
  50. }