Ejemplo n.º 1
0
        public IEnumerable <HospitalProfileDto> GetHospitals(bool isCenter)
        {
            var rep = new HospitalProfileRepository(_DBContext);

            if (isCenter)
            {
                return
                    (rep.Get(p => p.IsConsultation.HasValue && p.IsConsultation.Value.Equals(isCenter))
                     .Select(Mapper.Map <HospitalProfile, HospitalProfileDto>));
            }
            return(rep.Get().Select(Mapper.Map <HospitalProfile, HospitalProfileDto>));
        }
Ejemplo n.º 2
0
        public bool SaveHospital(HospitalProfileDto hospitalDto)
        {
            hospitalDto.LastEditTime = DateTime.Now;
            hospitalDto.LastEditUser = _LoginUserService.CurrentUserID;
            var rep      = new HospitalProfileRepository(_DBContext);
            var existing = rep.Get(h => h.UniqueID == hospitalDto.UniqueID).FirstOrDefault();

            if (existing == null)
            {
                rep.Add(Mapper.Map <HospitalProfileDto, HospitalProfile>(hospitalDto));
            }
            else
            {
                Mapper.Map(hospitalDto, existing);
                rep.Update(existing);
            }
            rep.SaveChanges();
            return(true);
        }