public async Task <Myfund> Save2(Myfund obj) { return(await WithConnection(async c => { string sql = $@" INSERT INTO `myfund`( code, name, balance, costavg, networth, totalworth, worthdate, daygrowth, updatetime ) VALUES ( @Code, @Name, @Balance, @Costavg, @Networth, @Totalworth, @Worthdate, @Daygrowth, @Updatetime ); "; sql += "SELECT LAST_INSERT_ID() "; int newid = await c.QueryFirstOrDefaultAsync <int>(sql, obj); obj.Id = newid; return obj; })); }
public async Task <int> UpdateExpectGrowth(Myfund obj) { return(await WithConnection(async c => { var result = await c.ExecuteAsync($@" UPDATE myfund set expectgrowth=@ExpectGrowth where id=@Id", obj); return result; })); }
public async Task <int> Update2(Myfund obj) { return(await WithConnection(async c => { var result = await c.ExecuteAsync($@" UPDATE myfund set balance=@Balance, costavg=@Costavg, updatetime=@Updatetime where id=@Id", obj); return result; })); }
public async Task <int> Update(Myfund obj) { return(await WithConnection(async c => { var result = await c.ExecuteAsync($@" UPDATE myfund set networth=@Networth, totalworth=@Totalworth, worthdate=@Worthdate, daygrowth=@Daygrowth, updatetime=@Updatetime where id=@Id", obj); return result; })); }
public async Task <ActionResult <ApiResult> > GetById([FromQuery] Myfund obj) { ApiResult ret = new ApiResult { code = Code.Failure }; try { ret = await _service.GetById(obj.Id); } catch (System.Exception ex) { ret.msg = string.Format( "获取分页数据Myfund失败, 异常信息:{0}", ex.Message); } return(ret); }