public void Update(PK id, TParam param) { ValidateParametersSpecific(param, id); TEntity oldEntity = Dao.Find(id); TEntity newEntity = ParamConverter.Convert(param, oldEntity); Dao.Update(newEntity); }
public TResult Create(TParam param) { ValidateParametersStandart(param); ValidateParametersSpecific(param, default); TEntity entity = ParamConverter.Convert(param, null); Dao.Save(entity); return(ResultConverter.Convert(entity)); }
public List <TResult> Create(List <TParam> param) { List <TEntity> entities = new List <TEntity>(); param.ForEach(item => entities.Add(ParamConverter.Convert(item, null))); Dao.Save(entities); List <TResult> result = new List <TResult>(); entities.ForEach(entity => result.Add(ResultConverter.Convert(entity))); return(result); }
public void Update(List <TParam> param) { List <TEntity> entities = new List <TEntity>(); foreach (var item in param) { TEntity oldEntity = Dao.Find(GetPK(item)); TEntity newEntity = ParamConverter.Convert(item, oldEntity); entities.Add(newEntity); } Dao.Update(entities); }