Exemple #1
0
        public Clinic AddClinic(string clinicName, string clinicDesc, string clinicContactTel, int clinicCategoryId, int clinicTypeId,
                                string clinicAddressStreet, string clinicAddressCity, string clinicAddressProvState, string clinicAddressPostZipCode, string clinicAddressCountry)
        {
            var clinicAddress = new ClinicAddress(clinicAddressStreet, clinicAddressCity, clinicAddressProvState,
                                                  clinicAddressPostZipCode, clinicAddressCountry);


            //clinic.ClinicAddress = address;

            return(new Clinic
            {
                ClinicName = clinicName,
                ClinicDesc = clinicDesc,
                ClinicContactTel = clinicContactTel,
                ClinicCategoryId = clinicCategoryId,
                ClinicTypeId = clinicTypeId,
                ClinicAddress = clinicAddress,
                CreateDate = DateTime.Now,
                UpdateDate = DateTime.Now
            });

            //}(clinic.ClinicName,
            //    clinic.ClinicDesc,
            //    clinic.ClinicContactTel,
            //    clinic.ClinicWebsite,
            //    clinic.ClinicCategoryId,
            //    clinic.ClinicTypeId);
        }
        public void AddClinic(Clinic clinic, ClinicAddress address)
        {
            //throw new NotImplementedException();

            //clinic.ClinicAddress = address;

            _context.Clinics.Add(clinic);

            try
            {
                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                throw;
            }
        }