/// <summary> /// 更新单个数据 /// </summary> /// <param name="dto">sys_userrole实体</param> /// <returns></returns> public async Task <Result <Sys_UserRoleDto> > UpdateAsync(Sys_UserRoleDto dto) { using (var db = GetDb()) { var result = new Result <Sys_UserRoleDto>(); db.Update(MapTo <Sys_UserRoleDto, Sys_UserRoleEntity>(dto)); result.flag = (await db.SaveChangesAsync()) > 0; return(result); } }
/// <summary> /// 删除单个sys_userrole /// </summary> /// <param name="dto">sys_userrole实体</param> /// <returns></returns> public async Task <Result <Sys_UserRoleDto> > DeleteAsync(Sys_UserRoleDto dto) { using (var db = GetDb()) { var result = new Result <Sys_UserRoleDto>(); var ds = GetDbSet(db); var entity = MapTo <Sys_UserRoleDto, Sys_UserRoleEntity>(dto); ds.Remove(entity); result.flag = (await db.SaveChangesAsync()) > 0; return(result); } }