コード例 #1
0
ファイル: NewLabsController.cs プロジェクト: Thobb/Cloudies
        public ActionResult Index(ViewModelNewLab newLab)
        {
            Lab lab = new Lab();
            lab.Start_Time = newLab.Start_Time;
            lab.End_Time = newLab.End_Time;
            lab.Name = newLab.Name.Trim();
            lab.Time_Zone = "Asia/Calcutta";
            lab.Status = "Scheduled";
            lab.User_ID = 5;

            LabConfiguration labConfig = new LabConfiguration();
            labConfig.OS = newLab.OS.Trim();
            labConfig.VM_Count = newLab.VM_Count;
            labConfig.Hard_Disk = newLab.Hard_Disk.Trim();
            labConfig.VM_Type = newLab.VM_Type.Trim();
            labConfig.Networked = newLab.VMNetwork.Trim();

            IjepaiEntities db = new IjepaiEntities();
            db.LabConfigurations.Add(labConfig);

            try
            {
                db.SaveChanges();
                lab.Config_ID = labConfig.ID;
                db.Labs.Add(lab);
                db.SaveChanges();
                StoreParticipants(newLab.Participants, lab.ID);
            }
            catch (Exception ex)
            {
                string message = ex.ToString();
            }

            return View("~/Views/MyLabs/Index.cshtml");
        }
コード例 #2
0
        public ActionResult NewLab(ViewModelNewLab newLab)
        {
            Lab lab = new Lab();
            lab.Start_Time = newLab.Start_Time;
            lab.End_Time = newLab.End_Time;
            lab.Name = newLab.Name;
            lab.Time_Zone = "Asia/Calcutta";
            lab.User_ID = 1;

            LabConfiguration labConfig = new LabConfiguration();
            labConfig.OS = newLab.OS;
            labConfig.RAM = newLab.Ram;
            labConfig.VM_Count = newLab.VM_Count;
            labConfig.Hard_Disk = newLab.Hard_Disk;

            IjepaiEntities db = new IjepaiEntities();
            db.LabConfigurations.Add(labConfig);
            lab.Config_ID = labConfig.ID;
            db.Labs.Add(lab);
            db.SaveChanges();

            return View("~/Views/MyLabs/LabDetail.cshtml", newLab);
        }