public JsonResult getModels() { using (var ctx = new ITStockEntities1()) { var models = (from d in db.Models join i in db.Brands on d.BrandID equals i.BrandID into tempPets from i in tempPets.DefaultIfEmpty() join p in db.DeviceTypes on d.DeviceTypeID equals p.DeviceTypeID into tempPets2 from p in tempPets2.DefaultIfEmpty() select new ViewDeviceModels { ModelID = d.ModelID, CreateBy = d.CreateBy, UpdateBy = d.UpdateBy, DateCreate = d.DateCreate, DateUpdate = d.DateUpdate, Specification = d.Specification, IsAccess = d.IsAccess, Description = d.Description, BrandName = i.BrandName, DeviceType = p.Type, ModelName = d.ModelName, }).ToList(); return(Json(new { data = models.OrderBy(p => p.ModelName) }, JsonRequestBehavior.AllowGet)); } }
public JsonResult getDeviceType() { using (var ctx = new ITStockEntities1()) { //Disable Proxy creation ctx.Configuration.ProxyCreationEnabled = false; var type = ctx.DeviceTypes.OrderBy(p => p.Type).ToList(); return(Json(new { data = type }, JsonRequestBehavior.AllowGet)); } }
public JsonResult getBrand() { using (var ctx = new ITStockEntities1()) { //Disable Proxy creation ctx.Configuration.ProxyCreationEnabled = false; var brand = ctx.Brands.OrderBy(p => p.BrandName).ToList(); return(Json(new { data = brand }, JsonRequestBehavior.AllowGet)); } }
public PlantRepository(ITStockEntities1 context) { this.context = context; }