public ActionResult Edit(string id) { PM_ProjectInfoBids form = null; List <ComboItem> depAmtStatus = null; using (var db = new SysContext()) { depAmtStatus = db.Database.SqlQuery <ComboItem>("select Text Text, Value Value from sys_code where " + string.Format("{0}", "/*TABLEALIAS*/CodeType='depAmt'")).ToList(); } using (var db = new LUOLAI1401Context()) { form = db.Database.SqlQuery <PM_ProjectInfoBidsViewable>("select a.FID ,a.Code ,a.ProjName ,b.Contact CustID_RefText ,a.CustID ,a.appNumber ,a.Owner ,a.totalInvAmt ,a.depAmt ,a.depAmtStatus ,a.advAmt ,a.bookAmt ,a.bidAmt ,a.agencyAmt ,a.PManager ,a.bidDate ,a.bidAddress ,a.bidPerson ,a.bidAgent ,a.Attention ,a.Winner ,a.Remark ,a.CreatePerson ,a.CreateDate ,a.UpdateDate ,a.UpdatePerson from PM_ProjectInfoBids a LEFT JOIN BD_Customers b ON a.CustID = b.FID where a.Code = @key", new System.Data.SqlClient.SqlParameter("@key", id)).FirstOrDefault(); } ViewBag.RowState = 2; if (form == null) { ViewBag.RowState = 1; form = new PM_ProjectInfoBids { Code = id, depAmtStatus = string.Format("{0}", "5") }; } return(View(new { form = form, dataSource = new { depAmtStatus } })); }
public ActionResult Edit(long id) { PM_ProjectInfoBids form = null; using (var db = new LUOLAI1401Context()) { form = db.PM_ProjectInfoBids.Find(id); } ViewBag.RowState = 2; if (form == null) { ViewBag.RowState = 1; form = new PM_ProjectInfoBids { FID = id }; } return(View(new { form = form, dataSource = new { } })); }