Пример #1
0
 public ActionResult Edit([Bind(Include = "Id,FIO,Nation,BirthDate,BirthPlace,LivePlace,Pol,Job,Insurance,DocType,DocNum")] Doctor doctor)
 {
     if (ModelState.IsValid)
     {
         db.Entry(doctor).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(doctor));
 }
        public ActionResult AddVisit(DoctorFreeTimeViewModel model)
        {
            Patient  patient  = db.PatientSet.Find(model.PatientId);
            WorkTime record   = new WorkTime();
            FreeTime freeTime = db.FreeTimeSet.Find(model.FreeTimeId);
            Doctor   doctor   = db.DoctorSet.Find(model.DoctorId);

            if (patient != null)
            {
                if (ModelState.IsValid && model.DoctorId != -1 && model.FreeTimeId != -1)
                {
                    record.Doctor    = doctor;
                    record.StartTime = freeTime.StartTime;
                    record.Patient   = patient;

                    patient.WorkTime.Add(record);

                    db.FreeTimeSet.Remove(freeTime);

                    db.Entry(patient).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Visits", patient));
                }
            }
            ViewBag.Message = "Выберите врача и время";
            return(RedirectToAction("Visits", patient));
        }
 public ActionResult Edit([Bind(Include = "Id")] DocRecord docRecord)
 {
     if (ModelState.IsValid)
     {
         db.Entry(docRecord).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(docRecord));
 }
 public ActionResult Edit([Bind(Include = "Id,StartTime")] WorkTime workTime)
 {
     if (ModelState.IsValid)
     {
         db.Entry(workTime).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(workTime));
 }
Пример #5
0
 public ActionResult Edit([Bind(Include = "Id,Name")] Illness illness)
 {
     if (ModelState.IsValid)
     {
         db.Entry(illness).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(illness));
 }
 public ActionResult Edit([Bind(Include = "Id,FIO,Nation,BirthDate,BirthPlace,LivePlace,Pol")] Person person)
 {
     if (ModelState.IsValid)
     {
         db.Entry(person).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(person));
 }
 public ActionResult Edit([Bind(Include = "Id,Name,Number")] Documents documents)
 {
     if (ModelState.IsValid)
     {
         db.Entry(documents).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(documents));
 }
Пример #8
0
 public ActionResult Edit([Bind(Include = "Id,StartTime")] WorkTime workTime)
 {
     workTime = db.WorkTimeSet.Find(workTime.Id);
     if (workTime != null)
     {
         db.Entry(workTime).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(workTime));
 }
Пример #9
0
 public ActionResult Edit([Bind(Include = "Id,FIO,Nation,BirthDate,BirthPlace,LivePlace,Pol,OMS,Blood,DocType,DocNum")] Patient patient)
 {
     if (ModelState.IsValid)
     {
         db.Entry(patient).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(patient));
 }