示例#1
0
        public ActionResult InitialSetup(InitialSetup setup)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            var conString = $"Data Source={setup.ServerName};Initial Catalog={setup.DatabaseName};Persist Security Info=True;";

            if (setup.IntegratedSecurity)
            {
                conString += "Integrated Security = true;";
            }
            else
            {
                conString += $"User ID={setup.Username};Password={setup.Password};";
            }

            var path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            System.IO.File.AppendAllText(path + "\\creds.txt", conString);

            using (var context = new StudentAppDbContext())
            {
                context.Logs.Add(new Log
                {
                    Message = "Initial setup completed"
                });
                context.SaveChanges();
            }
            return(RedirectToAction("Index"));
        }
示例#2
0
        static void Main(string[] args)
        {
            StudentAppDbContext ob = new StudentAppDbContext();

            Student s1 = new Student();

            s1.Name = "Vishnu";

            s1.MobileNo = "898989898";



            ob.Add(s1);//

            ob.SaveChanges();
            Console.WriteLine("Hello World!");
        }
示例#3
0
        public ActionResult Index(Student model)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            using (var context = new StudentAppDbContext())
            {
                context.Students.Add(new Student
                {
                    StdName = model.StdName,
                    StdSex  = model.StdSex,
                    StdAddr = model.StdAddr,
                    StdDOB  = model.StdDOB,
                    StdNat  = model.StdNat
                });
                context.SaveChanges();
            }
            return(RedirectToAction("Index"));
        }
 public TenantRoleAndUserBuilder(StudentAppDbContext context, int tenantId)
 {
     _context  = context;
     _tenantId = tenantId;
 }
示例#5
0
 public DefaultEditionsCreator(StudentAppDbContext context)
 {
     _context = context;
 }
 public InitialHostDbBuilder(StudentAppDbContext context)
 {
     _context = context;
 }
 public StudentListRepository(StudentAppDbContext context)
 {
     _studentContext = context;
 }
示例#8
0
 public DefaultSettingsCreator(StudentAppDbContext context)
 {
     _context = context;
 }
 public DefaultLanguagesCreator(StudentAppDbContext context)
 {
     _context = context;
 }
 public StudentController()
 {
     studentDbContext = new StudentAppDbContext();
 }
 public DefaultTenantCreator(StudentAppDbContext context)
 {
     _context = context;
 }
示例#12
0
 public HostRoleAndUserCreator(StudentAppDbContext context)
 {
     _context = context;
 }