Ejemplo n.º 1
0
 public int UpdateLookUp(mp_lookup lookup)
 {
     var existing = _context.mp_lookup.FirstOrDefault(m => m.id == lookup.id);
     if (existing != null)
     {
         //do update
         lookup.deleted = 0;
         _context.Entry(existing).CurrentValues.SetValues(lookup);
         return _context.SaveChanges();
     }
     return 0;
 }
Ejemplo n.º 2
0
        public void Update(mp_clinic clinic)
        {
            var old = _context.mp_clinic.FirstOrDefault(e => e.id == clinic.id);

            clinic.created_at = old.created_at;
            _context.Entry(old).CurrentValues.SetValues(clinic);
            _context.SaveChanges();
        }
Ejemplo n.º 3
0
        public void Update(mp_employment employment)
        {
            var old = _context.mp_employment.FirstOrDefault(e => e.id == employment.id);

            employment.created_at = old.created_at;

            _context.Entry(old).CurrentValues.SetValues(employment);
            _context.SaveChanges();
        }
Ejemplo n.º 4
0
        public void Update(mp_family_history family_History)
        {
            var old = _context.mp_family_history.FirstOrDefault(e => e.id == family_History.id);

            family_History.created_at = old.created_at;

            _context.Entry(old).CurrentValues.SetValues(family_History);
            _context.SaveChanges();
        }
Ejemplo n.º 5
0
        public void Update(mp_children children)
        {
            var old = _context.mp_children.FirstOrDefault(e => e.id == children.id);

            children.created_at = old.created_at;

            _context.Entry(old).CurrentValues.SetValues(children);
            _context.SaveChanges();
        }
        public void Update(mp_applicant profile)
        {
            var old = _context.mp_applicant.FirstOrDefault(e => e.id == profile.id);

            profile.created_at = old.created_at;

            _context.Entry(old).CurrentValues.SetValues(profile);
            _context.SaveChanges();
        }
Ejemplo n.º 7
0
        public void Update(mp_appointment_refund refund)
        {
            var old = _context.mp_appointment_refund.FirstOrDefault(e => e.id == refund.id);

            refund.created_at = DateTime.Now;
            refund.created_by = refund.created_by;

            _context.Entry(old).CurrentValues.SetValues(refund);
            _context.SaveChanges();
        }
        public void Update(mp_appointment appointment)
        {
            var old = _context.mp_appointment.FirstOrDefault(e => e.id == appointment.id);

            appointment.created_at = old.created_at;
            appointment.created_by = old.created_by;

            _context.Entry(old).CurrentValues.SetValues(appointment);
            _context.SaveChanges();
        }
 public ActionResult Edit([Bind(Include = "PregledID,Naziv,Opis")] Pregled pregled)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pregled).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(pregled));
 }
        public static void MarkAsRead(long notification_id)
        {
            var old = _context.mp_notification.FirstOrDefault(e => e.id == notification_id);

            var notification = _context.mp_notification.FirstOrDefault(e => e.id == notification_id);

            notification.read = 1;

            _context.Entry(old).CurrentValues.SetValues(notification);
            _context.SaveChanges();
        }
Ejemplo n.º 11
0
        public void Update(mp_notification notification)
        {
            var old = _context.mp_notification.FirstOrDefault(e => e.id == notification.id);

            notification.created_at = old.created_at;
            notification.created_by = old.created_by;
            notification.updated_at = DateTime.Now;

            _context.Entry(old).CurrentValues.SetValues(notification);
            _context.SaveChanges();
        }
Ejemplo n.º 12
0
        public int AddPediatricEvaluation(mp_pediatric_evaluation evaluation)
        {
            var old = _context.mp_pediatric_evaluation.FirstOrDefault(e => e.appointment_id == evaluation.appointment_id && e.profile_id == evaluation.profile_id);

            if (old == null)
            {
                _context.Add(evaluation);
            }
            else
            {
                evaluation.created_by   = old.created_by;
                evaluation.created_date = old.created_date;
                evaluation.id           = old.id;

                _context.Entry(old).CurrentValues.SetValues(evaluation);
            }
            _context.SaveChanges();

            return(evaluation.id);
        }
        public void Update(mp_family_intake intake)
        {
            var old = _context.mp_family_intake.FirstOrDefault(e => e.id == intake.id);

            intake.updated_at = DateTime.Now;

            intake.created_at = old.created_at;
            intake.created_by = old.created_by;

            _context.Entry(old).CurrentValues.SetValues(intake);
            _context.SaveChanges();
        }
Ejemplo n.º 14
0
        public int UpdateProfileDocument(mp_clinician_document document)
        {
            var existing = _context.mp_clinician_document.FirstOrDefault(m => m.id == document.id);

            if (existing != null)
            {
                //do update
                document.created_at = existing.created_at;
                _context.Entry(existing).CurrentValues.SetValues(document);
                return(_context.SaveChanges());
            }
            return(0);
        }
Ejemplo n.º 15
0
        public int UpdatePsychosocial(mp_psychosocial psychosocial)
        {
            var existing = _context.mp_psychosocial.FirstOrDefault(m => m.id == psychosocial.id);

            if (existing != null)
            {
                //do update
                psychosocial.created_at = existing.created_at;
                psychosocial.created_by = existing.created_by;
                _context.Entry(existing).CurrentValues.SetValues(psychosocial);
                return(_context.SaveChanges());
            }
            return(0);
        }
Ejemplo n.º 16
0
        //updates mp_substance_use record
        //returns 0 if record was not found
        public int UpdateSubstanceUse(mp_substance_use substance_use)
        {
            var existing = _context.mp_substance_use.FirstOrDefault(m => m.id == substance_use.id);

            if (existing != null)
            {
                //do update
                substance_use.created_at = existing.created_at;
                substance_use.created_by = existing.created_by;
                _context.Entry(existing).CurrentValues.SetValues(substance_use);
                return(_context.SaveChanges());
            }
            return(0);
        }
Ejemplo n.º 17
0
        public int UpdateProgressNote(mp_progress_note note)
        {
            var existing = _context.mp_progress_note.FirstOrDefault(m => m.id == note.id);

            if (existing != null)
            {
                //do update
                note.created_at = existing.created_at;
                note.created_by = existing.created_by;
                _context.Entry(existing).CurrentValues.SetValues(note);
                return(_context.SaveChanges());
            }
            return(0);
        }
        public int UpdateSocialRelationship(mp_social_relationship relationship)
        {
            var existing = _context.mp_social_relationship.FirstOrDefault(m => m.id == relationship.id);

            if (existing != null)
            {
                //do update
                relationship.created_at = existing.created_at;
                relationship.created_by = existing.created_by;
                _context.Entry(existing).CurrentValues.SetValues(relationship);
                return(_context.SaveChanges());
            }
            return(0);
        }
        public void AddOrUpdate(mp_clinician_availability availability)
        {
            if (_context.mp_clinician_availability.Any(e => e.clinician_id == availability.clinician_id && e.day_name == availability.day_name))
            {
                // run update
                var old = _context.mp_clinician_availability.FirstOrDefault(e => e.clinician_id == availability.clinician_id && e.day_name == availability.day_name);
                availability.id = old.id;
                _context.Entry(old).CurrentValues.SetValues(availability);
            }
            else
            {
                _context.mp_clinician_availability.Add(availability);
            }

            _context.SaveChanges();
        }
Ejemplo n.º 20
0
        public ActionResult EditPost(int?id, HttpPostedFileBase upload)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var lekarZaUpdate = db.Lekari.Find(id);

            if (TryUpdateModel(lekarZaUpdate, "",
                               new string[] { "ID", "Prezime", "Ime", "DatumZaposlenja", "Email" }))
            {
                try
                {
                    if (upload != null && upload.ContentLength > 0)
                    {
                        if (lekarZaUpdate.Files.Any(f => f.FileType == FileType.Foto))
                        {
                            db.Files.Remove(lekarZaUpdate.Files.First(f => f.FileType == FileType.Foto));
                        }
                        var foto = new File
                        {
                            FileName    = System.IO.Path.GetFileName(upload.FileName),
                            FileType    = FileType.Foto,
                            ContentType = upload.ContentType
                        };
                        using (var reader = new System.IO.BinaryReader(upload.InputStream))
                        {
                            foto.Content = reader.ReadBytes(upload.ContentLength);
                        }
                        lekarZaUpdate.Files = new List <File> {
                            foto
                        };
                    }
                    db.Entry(lekarZaUpdate).State = EntityState.Modified;
                    db.SaveChanges();

                    return(RedirectToAction("Index"));
                }
                catch (DataException)
                {
                    ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator.");
                }
            }
            return(View(lekarZaUpdate));
        }
        public void AddOrUpdate(mp_clinician_rating rating)
        {
            var old = _context.mp_clinician_rating.FirstOrDefault(e => e.id == rating.id);

            if (old != null)
            {
                rating.created_at = old.created_at;
                rating.created_by = old.created_by;
                _context.Entry(old).CurrentValues.SetValues(rating);
            }
            else
            {
                rating.created_at = DateTime.Now;
                _context.mp_clinician_rating.Add(rating);
            }

            _context.SaveChanges();
        }
        public void AddOrUpdate(mp_profile_bank bank)
        {
            var old = _context.mp_profile_bank.FirstOrDefault(e => e.id == bank.id);

            if (old != null)
            {
                bank.created_at = old.created_at;
                bank.created_by = old.created_by;
                bank.updated_at = DateTime.Now;

                _context.Entry(old).CurrentValues.SetValues(bank);
            }
            else
            {
                bank.created_at = DateTime.Now;
                _context.mp_profile_bank.Add(bank);
            }
            _context.SaveChanges();
        }
Ejemplo n.º 23
0
        public void AddOrUpdate(mp_profile_hmo hmo)
        {
            var old = _context.mp_profile_hmo.FirstOrDefault(e => e.id == hmo.id);

            if (old != null)
            {
                hmo.created_at = old.created_at;
                hmo.created_by = old.created_by;
                hmo.updated_at = DateTime.Now;

                _context.Entry(old).CurrentValues.SetValues(hmo);
            }
            else
            {
                hmo.created_at = DateTime.Now;
                _context.mp_profile_hmo.Add(hmo);
            }
            _context.SaveChanges();
        }
        public void AddOrUpdate(mp_applicant_checklist applicant_checklist)
        {
            var old = _context.mp_applicant_checklist.FirstOrDefault(e => e.clinician_id == applicant_checklist.clinician_id);

            if (old != null)
            {
                applicant_checklist.created_at = old.created_at;
                applicant_checklist.updated_at = DateTime.Now;
                applicant_checklist.created_by = old.created_by;

                _context.Entry(old).CurrentValues.SetValues(applicant_checklist);
            }
            else
            {
                applicant_checklist.created_at = DateTime.Now;

                _context.mp_applicant_checklist.Add(applicant_checklist);
            }
            _context.SaveChanges();
        }
Ejemplo n.º 25
0
        public void AddOrUpdate(mp_service_costing service_cost)
        {
            var old = _context.mp_service_costing.FirstOrDefault(e => e.clinician_id == service_cost.clinician_id && e.appointment_service_id == service_cost.appointment_service_id && e.appointment_activity_sub_id == service_cost.appointment_activity_sub_id);

            if (old != null)
            {
                service_cost.id         = old.id;
                service_cost.created_at = old.created_at;
                service_cost.created_by = old.created_by;
                service_cost.updated_at = DateTime.Now;

                _context.Entry(old).CurrentValues.SetValues(service_cost);
            }
            else
            {
                service_cost.created_at = DateTime.Now;
                _context.mp_service_costing.Add(service_cost);
            }

            _context.SaveChanges();
        }