コード例 #1
0
ファイル: HomeController.cs プロジェクト: krsnik02/5Bites
 public ActionResult Transactions()
 {
     var m = new Models.Home.Transactions.ViewModel();
     using (var db = new dbEntities())
     {
         var ts = db.Transactions;
         foreach (var t in ts)
         {
             var tm = new Models.Home.Transactions.TransactionModel();
             tm.EmployeeName = t.Employee.Username;
             tm.StoreName = t.Store.Location.Name;
             tm.ProductName = t.Product.Name;
             tm.Quantity = t.Quantity;
             tm.Timestamp = t.Timestamp;
             m.Transactions.Add(tm);
         }
     }
     return View(m);
 }
コード例 #2
0
        public ActionResult Transactions()
        {
            var m = new Models.Home.Transactions.ViewModel();

            using (var db = new dbEntities())
            {
                var ts = db.Transactions;
                foreach (var t in ts)
                {
                    var tm = new Models.Home.Transactions.TransactionModel();
                    tm.EmployeeName = t.Employee.Username;
                    tm.StoreName    = t.Store.Location.Name;
                    tm.ProductName  = t.Product.Name;
                    tm.Quantity     = t.Quantity;
                    tm.Timestamp    = t.Timestamp;
                    m.Transactions.Add(tm);
                }
            }
            return(View(m));
        }