//
 // GET: /Management/
 public async Task<ActionResult> Index()
 {
     try
     {
         var serviceJs = new CatSerializeService();
         ViewBag.ScreenSizes = await serviceJs.GetScreenSizeAsync(Db);
         return View();
     }
     catch (Exception ex)
     {
         ViewBag.Error = ex.Message;
         return View();
     }
 }
 public ActionResult Upsert(int? id)
 {
     try
     {
         Screen model;
         if (id.HasValue)
         {
             model = Db.Screen.Single(e => e.ScreenId == id);
             ViewBag.Screens = new JavaScriptSerializer().Serialize(model.ScreenSchedule.Select(e => new
             {
                 x = e.PositionX,
                 y = e.PositionY,
                 z = e.PositionZ,
                 w = e.Width,
                 h = e.Height,
                 active = false,
                 selected = false,
                 name = e.Channel.Name,
                 idChannel = e.ChannelId,
                 id = e.ScreenId
             }));
         }
         else
         {
             ViewBag.Screens = "[]";
             model = new Screen();
         }
         var serviceJs = new CatSerializeService();
         ViewBag.ScreenSizes = serviceJs.GetScreenSize(Db);
         ViewBag.Channels = serviceJs.GetChannels(Db);
         return View(model);
     }
     catch (Exception ex)
     {
         ViewBag.Error = ex.Message;
         return View();
     }
 }