public OrganisationDto AddOrganisation(OrganisationDto organisationDto)
        {
            Address addr = new Address()
            {
                AddressId   = organisationDto.AddressId,
                AddressType = organisationDto.AddressType,
                StreetNo    = organisationDto.StreetNo,
                Area        = organisationDto.Area,
                City        = organisationDto.City,
                State       = organisationDto.State,
                Country     = organisationDto.Country,
                ZipCode     = organisationDto.ZipCode,
            };

            Context.Addresses.Add(addr);
            Context.SaveChanges();
            int addressid = addr.AddressId;

            var organisations = new Organisation()
            {
                OrganisationId      = organisationDto.OrganisationId,
                OrganisationName    = organisationDto.OrganisationName,
                OrganisationContact = organisationDto.OrganisationContact,
                AddressId           = addressid
            };

            Context.Organisations.Add(organisations);
            Context.SaveChanges();
            return(organisationDto);
        }
Esempio n. 2
0
        public HospitalDto AddHospital(HospitalDto hospitalDto)
        {
            var hospitals = new Hospital()
            {
                HospitalId = hospitalDto.HospitalId,

                HospitalName = hospitalDto.HospitalName,
                Contact      = hospitalDto.Contact,
            };

            Context.Hospitals.Add(hospitals);
            Context.SaveChanges();
            int hospitalId = hospitals.HospitalId;

            Address addr = new Address()
            {
                AddressId   = hospitalDto.AddressId,
                AddressType = hospitalDto.AddressType,
                StreetNo    = hospitalDto.StreetNo,
                Area        = hospitalDto.Area,
                City        = hospitalDto.City,
                State       = hospitalDto.State,
                Country     = hospitalDto.Country,
                ZipCode     = hospitalDto.ZipCode,
            };

            Context.Addresses.Add(addr);
            Context.SaveChanges();


            return(hospitalDto);
        }
        public LoginDto AddLogin(LoginDto loginDto)
        {
            Role rol = new Role()
            {
                RoleName = loginDto.RoleName
            };

            Context.Roles.Add(rol);
            Context.SaveChanges();
            int roleid = rol.RoleId;

            var logins = new Login()
            {
                LoginId         = loginDto.LoginId,
                Name            = loginDto.Name,
                Gender          = loginDto.Gender,
                Email           = loginDto.Email,
                Contact         = loginDto.Contact,
                Password        = loginDto.Password,
                ConfirmPassword = loginDto.Password,
                RoleId          = roleid
            };

            Context.Logins.Add(logins);
            Context.SaveChanges();
            return(loginDto);
        }
Esempio n. 4
0
        public PatientDto AddPatient(PatientDto patientDto)
        {
            var pat = new Patient()
            {
                PatientID   = patientDto.PatientID,
                PatientName = patientDto.PatientName,
                PAge        = patientDto.PAge,
                PGender     = patientDto.PGender,
                PEmail      = patientDto.PEmail,
                PContact    = patientDto.PContact,
                AadharID    = patientDto.AadharID,
            };

            Context.Patients.Add(pat);
            Context.SaveChanges();
            int patientID = pat.PatientID;

            Address addr = new Address()
            {
                AddressId   = patientDto.AddressId,
                AddressType = patientDto.AddressType,
                StreetNo    = patientDto.StreetNo,
                Area        = patientDto.Area,
                City        = patientDto.City,
                State       = patientDto.State,
                Country     = patientDto.Country,
                ZipCode     = patientDto.ZipCode,
            };

            Context.Addresses.Add(addr);
            Context.SaveChanges();

            Occupation ocp = new Occupation()
            {
                OccupationId   = patientDto.OccupationId,
                OccupationName = patientDto.OccupationName,
                OccupationType = patientDto.OccupationType,
                PatientID      = patientID
            };

            Context.Occupations.Add(ocp);
            Context.SaveChanges();

            Organisation organ = new Organisation()
            {
                OrganisationId      = patientDto.OrganisationId,
                OrganisationName    = patientDto.OrganisationName,
                OrganisationContact = patientDto.OrganisationContact,
                PatientID           = patientID
            };

            Context.Organisations.Add(organ);
            Context.SaveChanges();



            return(patientDto);
        }
        public TreatmentRecordsDto AddTreatmentRecords(TreatmentRecordsDto treatmentRecordsDto)
        {
            Address addr = new Address()
            {
                AddressId   = treatmentRecordsDto.AddressId,
                AddressType = treatmentRecordsDto.AddressType,
                StreetNo    = treatmentRecordsDto.StreetNo,
                Area        = treatmentRecordsDto.Area,
                City        = treatmentRecordsDto.City,
                State       = treatmentRecordsDto.State,
                Country     = treatmentRecordsDto.Country,
                ZipCode     = treatmentRecordsDto.ZipCode,
            };

            Context.Addresses.Add(addr);
            Context.SaveChanges();
            int addressid = addr.AddressId;

            Patient pat = new Patient()
            {
                PatientID   = treatmentRecordsDto.PatientID,
                PatientName = treatmentRecordsDto.PatientName,
                PAge        = treatmentRecordsDto.PAge,
                PGender     = treatmentRecordsDto.PGender,
                PEmail      = treatmentRecordsDto.PEmail,
                AadharID    = treatmentRecordsDto.AadharID,
                PContact    = treatmentRecordsDto.PContact,
                AddressId   = addressid,
            };

            Context.Patients.Add(pat);
            Context.SaveChanges();
            int patientid = pat.PatientID;

            Occupation occ = new Occupation()
            {
                OccupationId   = treatmentRecordsDto.OccupationId,
                OccupationName = treatmentRecordsDto.OccupationName,
                OccupationType = treatmentRecordsDto.OccupationType,
                PatientID      = patientid,
            };

            Context.Occupations.Add(occ);
            Context.SaveChanges();
            int occupationid = occ.OccupationId;

            Address orgaddr = new Address()
            {
                AddressId   = treatmentRecordsDto.Org_AddressId,
                AddressType = treatmentRecordsDto.Org_AddressType,
                StreetNo    = treatmentRecordsDto.Org_StreetNo,
                Area        = treatmentRecordsDto.Org_Area,
                City        = treatmentRecordsDto.Org_City,
                State       = treatmentRecordsDto.Org_State,
                Country     = treatmentRecordsDto.Org_Country,
                ZipCode     = treatmentRecordsDto.Org_ZipCode,
            };

            Context.Addresses.Add(orgaddr);
            Context.SaveChanges();
            int orgaddressid = orgaddr.AddressId;

            Organisation org = new Organisation()
            {
                OrganisationId      = treatmentRecordsDto.OrganisationId,
                OrganisationName    = treatmentRecordsDto.OrganisationName,
                OrganisationContact = treatmentRecordsDto.OrganisationContact,
                PatientID           = patientid,
                AddressId           = orgaddressid,
            };

            Context.Organisations.Add(org);
            Context.SaveChanges();

            Address hosaddr = new Address()
            {
                AddressId   = treatmentRecordsDto.Hos_AddressId,
                AddressType = treatmentRecordsDto.Hos_AddressType,
                StreetNo    = treatmentRecordsDto.Hos_StreetNo,
                Area        = treatmentRecordsDto.Hos_Area,
                City        = treatmentRecordsDto.Hos_City,
                State       = treatmentRecordsDto.Hos_State,
                Country     = treatmentRecordsDto.Hos_Country,
                ZipCode     = treatmentRecordsDto.Hos_ZipCode,
            };

            Context.Addresses.Add(hosaddr);
            Context.SaveChanges();
            int hosaddressid = hosaddr.AddressId;

            Hospital hos = new Hospital()
            {
                HospitalId   = treatmentRecordsDto.HospitalId,
                HospitalName = treatmentRecordsDto.HospitalName,
                Contact      = treatmentRecordsDto.Contact,
                AddressId    = hosaddressid,
            };

            Context.Hospitals.Add(hos);
            Context.SaveChanges();
            int hospitalid = hos.HospitalId;

            Disease dis = new Disease()
            {
                DiseaseId   = treatmentRecordsDto.DiseaseId,
                DiseaseName = treatmentRecordsDto.DiseaseName,
                DiseaseType = treatmentRecordsDto.DiseaseType
            };

            Context.Diseases.Add(dis);
            Context.SaveChanges();
            int diseaseid = dis.DiseaseId;



            TreatmentRecords trtr = new TreatmentRecords()
            {
                TreatmentRecordsId = treatmentRecordsDto.TreatmentRecordsId,
                PatientID          = patientid,
                HospitalId         = hospitalid,
                DiseaseId          = diseaseid,
                AdmittedDate       = treatmentRecordsDto.AdmittedDate,
                Prescription       = treatmentRecordsDto.Prescription,
                RelievingDate      = treatmentRecordsDto.RelievingDate,
                IsFatal            = treatmentRecordsDto.IsFatal,
                Currentstage       = treatmentRecordsDto.Currentstage
            };

            Context.TreatmentRecords.Add(trtr);
            Context.SaveChanges();
            int treatmentrecordsid = trtr.TreatmentRecordsId;

            return(treatmentRecordsDto);
        }
 public Disease Add(Disease disease)
 {
     Context.Set <Disease>().Add(disease);
     Context.SaveChanges();
     return(disease);
 }
Esempio n. 7
0
 public Role Add(Role role)
 {
     Context.Set <Role>().Add(role);
     Context.SaveChanges();
     return(role);
 }
Esempio n. 8
0
 public Occupation Add(Occupation occupation)
 {
     Context.Set <Occupation>().Add(occupation);
     Context.SaveChanges();
     return(occupation);
 }
Esempio n. 9
0
 public Address Add(Address address)
 {
     Context.Set <Address>().Add(address);
     Context.SaveChanges();
     return(address);
 }