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")); }
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!"); }
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; }
public DefaultEditionsCreator(StudentAppDbContext context) { _context = context; }
public InitialHostDbBuilder(StudentAppDbContext context) { _context = context; }
public StudentListRepository(StudentAppDbContext context) { _studentContext = context; }
public DefaultSettingsCreator(StudentAppDbContext context) { _context = context; }
public DefaultLanguagesCreator(StudentAppDbContext context) { _context = context; }
public StudentController() { studentDbContext = new StudentAppDbContext(); }
public DefaultTenantCreator(StudentAppDbContext context) { _context = context; }
public HostRoleAndUserCreator(StudentAppDbContext context) { _context = context; }