public ActionResult SpecialtyUpdate([DataSourceRequest] DataSourceRequest request, SpecialtyViewModel specialty)
        {
            if (specialty != null && ModelState.IsValid)
            {
                var s = _context.Specialty.SingleOrDefault(ss => ss.Id == specialty.Id);

                if (s != null)
                {
                    s.Name = specialty.Name;

                    _context.Specialty.Update(s);
                    _context.SaveChanges();
                }
            }

            return(Json(new[] { specialty }.ToDataSourceResult(request, ModelState)));
        }
        public ActionResult DoctorUpdate([DataSourceRequest] DataSourceRequest request, DoctorViewModel doctor)
        {
            if (doctor != null && ModelState.IsValid)
            {
                var d = _context.Doctor.SingleOrDefault(dd => dd.Id == doctor.Id);

                if (d != null)
                {
                    d.Name        = doctor.Name;
                    d.SpecialtyId = doctor.SpecialtyId;

                    _context.Doctor.Update(d);
                    _context.SaveChanges();
                }
            }

            return(Json(new[] { doctor }.ToDataSourceResult(request, ModelState)));
        }
Exemple #3
0
        public ActionResult VisitLogUpdate([DataSourceRequest] DataSourceRequest request, VisitLogViewModel visitLog)
        {
            if (visitLog != null && ModelState.IsValid)
            {
                var vl = _context.VisitLog.SingleOrDefault(dd => dd.Id == visitLog.Id);

                if (vl != null)
                {
                    vl.DoctorId  = visitLog.DoctorId;
                    vl.PatientId = visitLog.PatientId;
                    vl.Complaint = visitLog.Complaint;
                    vl.Diagnosis = visitLog.Diagnosis;
                    vl.VisitDate = visitLog.VisitDate;

                    _context.VisitLog.Update(vl);
                    _context.SaveChanges();
                }
            }

            return(Json(new[] { visitLog }.ToDataSourceResult(request, ModelState)));
        }
        public ActionResult PatientUpdate([DataSourceRequest] DataSourceRequest request, PatientViewModel patient)
        {
            if (patient != null && ModelState.IsValid)
            {
                var p1 = _context.Patient.SingleOrDefault(pp => pp.Id == patient.Id);

                if (p1 != null)
                {
                    p1.Name    = patient.Name;
                    p1.Iin     = patient.Iin;
                    p1.Address = patient.Address;
                    p1.Phone   = patient.Phone;


                    _context.Patient.Update(p1);
                    _context.SaveChanges();
                }
            }

            return(Json(new[] { patient }.ToDataSourceResult(request, ModelState)));
        }