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