示例#1
0
 public JsonResult SellerComission(DateTime startDate, DateTime endDate, string sellerId)
 {
     try
     {
         startDate = startDate.Date;
         endDate   = endDate.Date;
         var result = db.GetModelFromProcedure <SellerComissionModel>("get_SellerComission", new { startDate = startDate, endDate = endDate, userId = sellerId });
         var data   = new
         {
             StartDate      = startDate.ToLongDateString(),
             EndDate        = endDate.ToLongDateString(),
             Detail         = result,
             TotalSellPrice = result.Sum(r => r.SellPrice),
             TotalComission = result.Sum(r => r.Comission)
         };
         return(Json(new { Response = true, Data = data }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new { Response = false, Message = ex.Message }, JsonRequestBehavior.AllowGet));
     }
 }