public static UN fnGetUN(string id) { // fill a json object for View use using (var db = new EF.CMCSQL03Entities()) { UN obj = new UN(); var q = (from t in db.tblUN orderby t.UNID descending where t.UNNumber == id select t).FirstOrDefault(); obj.unid = q.UNID; obj.unnumber = q.UNNumber; obj.hazardclass = q.HazardClass; obj.propershippingname = q.ProperShippingName; obj.nosname = q.NOSName; obj.labelreq = q.LabelReq; obj.subclass = q.SubClass; obj.subsidlabelreq = q.SubSidLabelReq; obj.packinggroup = q.PackingGroup; return obj; } }
public ActionResult LookupUNSea(string id) { UN obj = new UN(); obj = ProductsService.fnGetUN(id); return Json(obj, JsonRequestBehavior.AllowGet); }