Пример #1
0
        public ActionResult Register(Patient patientinfo)
        {
            using (QMS_db db = new QMS_db())
            {
                String HostName = Dns.GetHostName();
                db.Patients.Add(new Patient
                   {
                       PatientId = patientinfo.PatientId,
                       PatientName = patientinfo.PatientName,
                       Status = "NEW",
                       TimeStamp = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
                       IP = "",

                   });

                db.SaveChanges();
            }

            using (QMS_db db = new QMS_db())
            {
                var item = (from p in db.Patients
                            where (p.PatientId == patientinfo.PatientId && p.PatientName == patientinfo.PatientName
                            && p.Status == "NEW")
                            select p).Single();

                return RedirectToAction("Index", new { Token = item.Token });
            }
        }
Пример #2
0
        public ActionResult IpSetting( List<IP> ipList)
        {
            if (ModelState.IsValid)
            {
                using (QMS_db qmsdb = new QMS_db())
                {
                    foreach (IP ip in ipList)
                    {
                        var i = (from r in qmsdb.IPs
                                 where r.Id == ip.Id
                                 select r).Single();

                        i.IP_Address = ip.IP_Address;
                        qmsdb.SaveChanges();

                    }
                }
                return RedirectToAction("IPSettingMsg");
            }
            return null;
        }