Пример #1
0
        public ActionResult MaterialInfos(string MaterialID)
        {
            using (DBEntities db = new DBEntities())
            {
                var MaterialColors = (from c in db.MaterialColors
                                      where c.MaterialID == MaterialID
                                      select new { ColorName = c.ColorName, ColorCode = c.ColorCode, IsSelected = c.IsDefault }).ToList();
                var MaterialPictures = (from p in db.MaterialPictures
                                        where p.MaterialID == MaterialID
                                        select new { p.GUID, p.Index, p.Name, p.FileName, p.Width, p.Height, p.Top, p.Left, p.UploadWidth, p.UploadHeight }).OrderBy(p => p.Index).ToList();

                return Content(JsonConvert.SerializeObject(new { MaterialColors, MaterialPictures }));
            }
        }
Пример #2
0
 //
 // GET: /Design/
 public ActionResult Index()
 {
     using (DBEntities db = new DBEntities())
     {
         var Materials = (from m in db.Materials
                          select new { GUID = m.GUID, Name = m.Name }).ToList();
         string MaterialID = Materials.FirstOrDefault().GUID;
         var MaterialColors = (from c in db.MaterialColors
                               where c.MaterialID == MaterialID
                               select new { ColorName = c.ColorName, ColorCode = c.ColorCode, IsSelected = c.IsDefault }).ToList();
         var MaterialPictures = (from p in db.MaterialPictures
                                 where p.MaterialID == MaterialID
                                 select new { p.GUID, p.Index, p.Name, p.FileName, p.Width, p.Height, p.Top, p.Left, p.UploadWidth, p.UploadHeight }).OrderBy(p => p.Index).ToList();
         ViewBag.Data = JsonConvert.SerializeObject(new { Materials, MaterialColors, MaterialPictures });
     }
     return View();
 }