/// <summary> /// 获取单条数据 /// </summary> /// <returns></returns> public V_ctms_pm_task Get(Expression <Func <ctms_pm_task, bool> > predicate = null) { using (ctms_pm_taskDAL dal = new ctms_pm_taskDAL()){ ctms_pm_task entity = dal.Get(predicate); return(EntityToModel(entity)); } }
/// <summary> /// 获取分页数据 /// </summary> /// <param name="page"></param> /// <returns></returns> public IEnumerable <V_ctms_pm_task> GetList(PageInfo page) { using (ctms_pm_taskDAL dal = new ctms_pm_taskDAL()){ var list = dal.Get(); return(list.Paging(ref page).Select(EntityToModel).ToList()); } }
/// <summary> /// 删除 /// </summary> /// <param name="id"></param> /// <returns></returns> public bool Delete(string id) { if (string.IsNullOrEmpty(id)) { return(false); } using (ctms_pm_taskDAL dal = new ctms_pm_taskDAL()){ return(dal.Delete(id)); } }
/// <summary> /// 更新 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool Edit(V_ctms_pm_task model) { if (model == null) { return(false); } using (ctms_pm_taskDAL dal = new ctms_pm_taskDAL()){ ctms_pm_task entitys = ModelToEntity(model); return(dal.Edit(entitys)); } }
/// <summary> /// 获取列表 /// </summary> /// <returns></returns> public IEnumerable <V_ctms_pm_task> Get() { using (ctms_pm_taskDAL dal = new ctms_pm_taskDAL()){ List <ctms_pm_task> entitys = dal.Get().ToList(); List <V_ctms_pm_task> list = new List <V_ctms_pm_task>(); foreach (ctms_pm_task item in entitys) { list.Add(EntityToModel(item)); } return(list); } }
/// <summary> /// 新增 /// </summary> /// <param name="model"></param> /// <returns></returns> public string Add(V_ctms_pm_task model) { if (model == null) { return(string.Empty); } using (ctms_pm_taskDAL dal = new ctms_pm_taskDAL()){ ctms_pm_task entity = ModelToEntity(model); entity.TASKID = string.IsNullOrEmpty(model.TASKID) ? Guid.NewGuid().ToString("N") : model.TASKID; return(dal.Add(entity)); } }