private void BtnGrabar_Click(object sender, EventArgs e) { using (ApplicationDBcontext db = new ApplicationDBcontext()) { try { user lv_user = new user(); lv_user.name = txtName.Text.Trim(); lv_user.email = txtUsuario.Text.Trim(); lv_user.password = txtPassword.Text.Trim(); lv_user.created_at = DateTime.Now; lv_user.updated_at = DateTime.Now; db.Users.Add(lv_user); db.SaveChanges(); MessageBox.Show("ok"); } catch (Exception ex) { MessageBox.Show("Error", ex.Message); } } }
private void Button1_Click(object sender, EventArgs e) { using (ApplicationDBcontext db = new ApplicationDBcontext()) { try { user lv_user = db.Users.FirstOrDefault(c => c.email == txtUsuario.Text.Trim()); string Encrypted = lv_user.password.Trim(); txtPassword.Text = lv_user.password.Trim(); txtFechaCreacion.Text = lv_user.created_at.ToString().Trim(); txtFechaActualizacion.Text = lv_user.updated_at.ToString().Trim(); string Key = "TcTFsNgBWME4f8rq3oisDuWXKUqB2H3nFxjX8Nciywc"; // string clave = Aes256CbcEncrypter.Decrypt(Encrypted, Key); //string clave = Aes256CbcEncrypter.Decryptphp(Encrypted, Key); // MessageBox.Show(clave); } catch (Exception ex) { MessageBox.Show("Error", ex.Message); } } }
public IdentityController( UserManager <ApplicationUser> usermanager, RoleManager <IdentityRole> rolemanager, ApplicationDBcontext context) { this.usermanager = usermanager; this.rolemanager = rolemanager; this.context = context; }
public List <user> GetDatabase() { List <user> usuarios = new List <user>(); using (ApplicationDBcontext db = new ApplicationDBcontext()) { try { //usuarios = db.Users.Where(c => DbFunctions.TruncateTime(c.created_at) // == DbFunctions.TruncateTime(DateTime.Now)) // .ToList(); usuarios = db.Users.ToList(); } catch (Exception ex) { usuarios = null; } } return(usuarios); }
public Repository(ApplicationDBcontext context) => _context = context;
public EmployeesController(ApplicationDBcontext context) { _context = context; }
public UpsertModel(ApplicationDBcontext db) { _db = db; }
public Employeesfamily(ApplicationDBcontext context) { _context = context; }
public BookController(ApplicationDBcontext db) { _db = db; }
public ClassroomController(ApplicationDBcontext context) { _context = context; }
// dBcontext is coming using dependecy injection //if no depedncy injection then we need to create object and then dispose it public BooksModel(ApplicationDBcontext dBcontext) { _db = dBcontext; }
public ResponseController(ApplicationDBcontext context) { _context = context; }
public PersonController(ApplicationDBcontext context) { _context = context; }
public IngredientController(ApplicationDBcontext context, UserManager <ApplicationUser> userManager) { _context = context; this.userManager = userManager; }
public PostsController(ApplicationDBcontext context, UserManager <ApplicationUser> usermanager) { this.context = context; this.usermanager = usermanager; }