12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using System.Data.Entity;
- using iiie.Logs.DBO;
- using iiie.WebApiUtils.BusinessManager;
- using iiie.WebApiUtils.DBO;
- using WebAPiUtils_test.DBO;
-
- namespace WebAPiUtils_test.DataAccess
- {
- public class ValuesManager : SqlServerManager<T_SqlManager, ValuesDboGet, ValuesDboAdd, ValuesDboEdit, SqlServerManagerEntities, ValuesManager>
- {
- public override DbSet<T_SqlManager> GetTable(SqlServerManagerEntities db)
- {
- return db.T_SqlManager;
- }
-
- public override ValuesDboGet DbToDboGet(T_SqlManager obj)
- {
- return new ValuesDboGet
- {
- Id = obj.id,
- MyInt = obj.my_int,
- MyString = obj.my_string,
- Text = obj.T_Text.text,
- TextId = obj.text
- };
- }
-
- public override OpResult<bool> DboAddToDb(ValuesDboAdd obj, T_SqlManager add)
- {
- var res = GetSingleById(obj.TextId);
- if (!res)
- return res.To<bool>();
- add.my_string = obj.MyString;
- add.my_int = obj.MyInt;
- add.text = obj.TextId;
- return OpResult<bool>.Ok(true);
- }
-
- public override OpResult<bool> DboEditToDb(ValuesDboEdit obj, T_SqlManager edit)
- {
- var res = GetSingleById(obj.TextId);
- if (!res)
- return res.To<bool>();
- edit.my_string = obj.MyString;
- edit.my_int = obj.MyInt;
- edit.text = obj.TextId;
- return OpResult<bool>.Ok(true);
- }
-
- public static OpResult<DboGetMultiple<ValuesDboGet>> Contains(string text, int page, int perPage)
- {
- return GetMultiple(x => x.my_string.Contains(text), x => x.id, page, perPage);
- }
- }
- }
|