예제 #1
0
 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;
     }));
 }
예제 #2
0
 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;
     }));
 }
예제 #3
0
 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;
     }));
 }
예제 #4
0
 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;
     }));
 }
예제 #5
0
        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);
        }