예제 #1
0
        public ResponseDTO CrearRegistro([FromBody] AccountUserDTO value)
        {
            var Response   = new ResponseDTO();
            var IdPersonal = value.EntityID;

            value.EntityID = 0;
            Data.ControlCenter.Model.AccountUser u = new Data.ControlCenter.Model.AccountUser();
            u = AutoMapper.Mapper.Map <AccountUserDTO, Data.ControlCenter.Model.AccountUser>(value);

            FuncionLogActualizaciones L = new FuncionLogActualizaciones();

            L.LogCreacion(u.Log);
            uR.SaveOrUpdate(u);
            if (u.EntityID > 0)
            {
                Response.Success = true;
                Response.Message = "Creado";

                switch (value.IdProfile)
                {
                case 1:
                {
                    API.PatientsController ApiUpdate = new PatientsController();
                    var oData = ApiUpdate.GetID(new PatientsDTO {
                            EntityID = IdPersonal
                        });
                    oData.IdAccountUser = u.EntityID;
                    ApiUpdate.UpdateRegistro(oData);
                    break;
                }

                case 2:
                {
                    API.MedicController ApiUpdate = new MedicController();
                    var oData = ApiUpdate.GetID(new MedicDTO {
                            EntityID = IdPersonal
                        });
                    oData.IdAccountUser = u.EntityID;
                    ApiUpdate.UpdateRegistro(oData);
                    break;
                }

                case 3:
                {
                    break;
                }
                }
            }
            return(Response);
        }
        public List <Models.Appointments_medicalDTO> ListIdMedico(int id)
        {
            var query = NHibernateSession.QueryOver <Data.ControlCenter.Model.Appointments_medical>()
                        .Where(de => de.IdMedic == id)
                        .List();

            IList <Models.Appointments_medicalDTO> cDTO = AutoMapper.Mapper.Map <IList <Data.ControlCenter.Model.Appointments_medical>, IList <Models.Appointments_medicalDTO> >(query);

            API.PatientsController ApiPaciente = new PatientsController();
            foreach (var item in cDTO)
            {
                item.Patient = ApiPaciente.GetID(new PatientsDTO {
                    EntityID = item.IdPatient
                });
            }
            return(cDTO.OrderByDescending(x => x.EntityID).ToList());
        }
        public Appointments_medicalDTO GetID([FromBody] Appointments_medicalDTO value)
        {
            Data.ControlCenter.Model.Appointments_medical u;
            Appointments_medicalDTO uDTO = new Appointments_medicalDTO();

            u = uR.GetById(value.EntityID, false);

            uDTO = AutoMapper.Mapper.Map <Data.ControlCenter.Model.Appointments_medical, Appointments_medicalDTO>(u);

            PatientsController ApiPaciente = new PatientsController();

            uDTO.Patient = ApiPaciente.GetID(new PatientsDTO {
                EntityID = uDTO.IdPatient
            });
            MedicController ApiMedico = new MedicController();

            uDTO.Medic = ApiMedico.GetID(new MedicDTO {
                EntityID = uDTO.IdPatient
            });
            return(uDTO);
        }