Beispiel #1
0
        private void FinalizeRegistration(RegisterModel model)
        {
            using (DoctorsContext context = new DoctorsContext())
            {
                var doctor = context.DoctorProfiles.First(x => x.Email == model.Email);

                doctor.Name       = model.Name;
                doctor.LastName   = model.LastName;
                doctor.SecondName = model.SecondName;

                doctor.PhoneNumber = model.PhoneNumber;

                doctor.Organisation = model.Organisation;
                doctor.Position     = model.Position;
                context.SaveChanges();
            }
        }
Beispiel #2
0
            public SimpleMembershipInitializer()
            {
                Database.SetInitializer <DoctorsContext>(null);

                try
                {
                    using (var context = new DoctorsContext())
                    {
                        if (!context.Database.Exists())
                        {
                            // Создание базы данных SimpleMembership без схемы миграции Entity Framework
                            ((IObjectContextAdapter)context).ObjectContext.CreateDatabase();
                        }
                    }

                    WebSecurity.InitializeDatabaseConnection("DefaultConnection", "DoctorProfile", "DoctorId", "Email", autoCreateTables: true);
                }
                catch (Exception ex)
                {
                    throw new InvalidOperationException("Не удалось инициализировать базу данных ASP.NET Simple Membership. Чтобы получить дополнительные сведения, перейдите по адресу: http://go.microsoft.com/fwlink/?LinkId=256588", ex);
                }
            }
Beispiel #3
0
 public DoctorsController(DoctorsContext context)
 {
     _context = context;
 }
 public DoctorsController(DoctorsContext doctorsContext)
 {
     _doctorsContext = doctorsContext;
 }