0

私は、1 日のトランザクションに対して 1 つの単純な制御を行うのが好きです。それは、今日のトランザクション (クローズまたはオープン トランザクション) の量を表示する必要があり、マネージャーがトランザクションの数をクリックすると、このすべてのトランザクションのリストを素敵なテーブルに送信したいと考えています。しかし、私はそれを行う方法を見つけることができません。ウェブ上でさえありません。

ここに私の試みがありますが、何もありません。私は提案を受け付けています=)

これが私のViewModelです

public class SIMcontrolsViewModel
{

    public DTControls DTransactionControl { get; set; }
}  
public class DTControls
{
    public DateTime TDate { get; set; }

    public int NumOfTransaction { get; set; }
    public List<SIMsale> SIMsaleList { get; set; }

    public DTControls()
    {
        SIMsaleList = new List<SIMsale>();
    }
}

コントローラーは、すべてのデータを入力して表示するように送信したように見えます

    [AdminAuthorization]
    public ActionResult DateTransactionsControl(DateTime? date)
    {
        SIMcontrolsViewModel vm = new SIMcontrolsViewModel();
        vm.DTransactionControl = new DTControls();
        if (!date.HasValue)
            date = DateTime.Now;//.Today;
        vm.DTransactionControl.TDate = date.Value;
        try
        {
            using (CompanyContext db = new CompanyContext())
            {
                var saleLst = db.SIMsales.ToList();

                foreach (var sale in saleLst)
                {
                    if (..)
                        vm.DTransactionControl.SIMsaleList.Add(sale);

                }
                var tCount = vm.DTransactionControl.SIMsaleList.Count;
                vm.DTransactionControl.NumOfTransaction = tCount;
            }
        }
        catch (Exception ex)
        {..}
        return View(vm); 
    }

今、私のビュー@Html.ActionLinkでは、ここで見られるように、このリストをこれから送信しようとしています。

@model oCc.IPToGo.ViewModel.SIMcontrolsViewModel


<fieldset>
      <table border="0" class="display">
            <thead>
                <tr>            
                   <th style="width:100px">Date</th>
            <th style="width:100px">@Html.DisplayNameFor(model => model.DTransactionControl.NumOfTransaction)</th>                
        </tr>
    </thead>
    <tbody>
        <tr style="text-align: center">
            <td>@Model.DTransactionControl.TDate.ToShortDateString()</td>
            @if (Model.DTransactionControl.NumOfTransaction != 0)
            {
                <td>
                    @Html.ActionLink(Model.DTransactionControl.NumOfTransaction.ToString(), "../SIMsale/",
                                                    new { sell = Model.DTransactionControl.SIMsaleList },
                                                    new { style = "font-weight: bold; color: Highlight" })
                </td>      

            }
            else
            {
                <td style="color:red">0</td>
            }
        </tr>
    </tbody>
</table>
 </fieldset>

問題は、このリストを取得するはずだったビュー/コントローラーが空のリストを取得していることです。

10Q =)

4

2 に答える 2