步步为盈
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1013 B

using BBWY.Server.Model.Db;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
namespace BBWY.Server.API.Controllers
{
public class TestController : BaseApiController
{
private IFreeSql fsql;
public TestController(IHttpContextAccessor httpContextAccessor, IFreeSql fsql) : base(httpContextAccessor)
{
this.fsql = fsql;
}
[HttpGet]
public IList<string> GetList()
{
return new List<string>() {
Guid.NewGuid().ToString(),
Guid.NewGuid().ToString(),
Guid.NewGuid().ToString(),
DateTime.Now.ToString()
};
}
[HttpGet("{orderId}")]
public decimal SumNoExists([FromRoute] string orderId)
{
var a = fsql.Select<OrderCoupon>().Where(oc => oc.OrderId == orderId).ToAggregate(g => g.Sum(g.Key.CouponPrice) );
return a;
}
}
}