Exemplo n.º 1
0
        // GET: Transaction
        public ActionResult Index()
        {
            TranViewModel tvm;
            RoadsEntities dbCxt = new RoadsEntities();

            tvm = new TranViewModel();

            tvm.Machs        = dbCxt.tblMaches.ToList();
            tvm.Acts         = dbCxt.tblActs.ToList();
            tvm.Emps         = dbCxt.tblEmps.ToList();
            tvm.Roads        = dbCxt.tblRoads.ToList();
            tvm.Transactions = dbCxt.tblTransactions.ToList();
            return(View("LoadTransaction", tvm));
        }
Exemplo n.º 2
0
 public ActionResult AddTransaction(TranViewModel tvm)
 {
     using (RoadsEntities db = new RoadsEntities())
     {
         tblTransaction tt = new tblTransaction();
         tt.Trans_Date    = tvm.Trans_Date;
         tt.Emp_No        = tvm.Emp_no;
         tt.Mach_No       = tvm.Mach_No;
         tt.BIA_No        = tvm.BIA_No;
         tt.Activity_Code = tvm.Activity_Code;
         tt.Hours         = tvm.Hours;
         tt.Lease_Chg     = tvm.Lease_Chg;
         db.tblTransactions.Add(tt);
         db.SaveChanges();
         ModelState.Clear();
     }
     return(RedirectToAction("Index"));
 }
Exemplo n.º 3
0
        public ActionResult EditingInline_Update([DataSourceRequest] DataSourceRequest request, TranViewModel tran)
        {
            RoadsEntities db = new RoadsEntities();
            var           t  = db.tblTransactions.Where(tr => tr.AutoNumber.Equals(tran.AutoNumber)).FirstOrDefault();

            t.Hours     = tran.Hours;
            t.Lease_Chg = tran.Lease_Chg;
            db.SaveChanges();
            return(Json(new[] { tran }.ToDataSourceResult(request, ModelState)));
        }