コード例 #1
0
 /// <summary>
 /// 更新单个数据
 /// </summary>
 /// <param name="dto">sys_userdepartment实体</param>
 /// <returns></returns>
 public async Task <Result <Sys_UserDepartmentDto> > UpdateAsync(Sys_UserDepartmentDto dto)
 {
     using (var db = GetDb())
     {
         var result = new Result <Sys_UserDepartmentDto>();
         db.Update(MapTo <Sys_UserDepartmentDto, Sys_UserDepartmentEntity>(dto));
         result.flag = (await db.SaveChangesAsync()) > 0;
         return(result);
     }
 }
コード例 #2
0
 /// <summary>
 /// 删除单个sys_userdepartment
 /// </summary>
 /// <param name="dto">sys_userdepartment实体</param>
 /// <returns></returns>
 public async Task <Result <Sys_UserDepartmentDto> > DeleteAsync(Sys_UserDepartmentDto dto)
 {
     using (var db = GetDb())
     {
         var result = new Result <Sys_UserDepartmentDto>();
         var ds     = GetDbSet(db);
         var entity = MapTo <Sys_UserDepartmentDto, Sys_UserDepartmentEntity>(dto);
         ds.Remove(entity);
         result.flag = (await db.SaveChangesAsync()) > 0;
         return(result);
     }
 }