Пример #1
0
        public ActionResult DeleteConfirmed(string id)
        {
            PcInfo pcInfo = db.PcInfos.Find(id);

            db.PcInfos.Remove(pcInfo);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "ControlNumber,IpAddress,Use,Type,ModelNumber,UserName,PcName,Remarks1,Remarks2")] PcInfo pcInfo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pcInfo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(pcInfo));
 }
Пример #3
0
        public ActionResult Create([Bind(Include = "ControlNumber,IpAddress,Use,Type,ModelNumber,UserName,PcName,Remarks1,Remarks2")] PcInfo pcInfo)
        {
            if (ModelState.IsValid)
            {
                db.PcInfos.Add(pcInfo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(pcInfo));
        }
Пример #4
0
 public Lan(bool[,] relationsMatrix, PcInfo[] computers)
 {
     this.relationsMatrix = relationsMatrix;
     this.computers = computers;
     rand = new Random();
     infected = new bool[computers.Length];
     for (int i = 0; i < computers.Length; i++)
     {
         infected[i] = computers[i].Infected;
     }
 }
Пример #5
0
        // GET: PcInfo/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PcInfo pcInfo = db.PcInfos.Find(id);

            if (pcInfo == null)
            {
                return(HttpNotFound());
            }
            return(View(pcInfo));
        }