private void CheckForNullTodoPagosContext(TodoPagosContext context) { if (context == null) { throw new ArgumentException(); } }
public PaymentsController() { TodoPagosContext context = new TodoPagosContext(); IUnitOfWork unitOfWork = new UnitOfWork(context); paymentService = new PaymentService(unitOfWork); signedInUsername = HttpContext.Current.User.Identity.Name; }
public EarningQueriesController() { TodoPagosContext context = new TodoPagosContext(); IUnitOfWork unitOfWork = new UnitOfWork(context); earningQueriesService = new EarningQueriesService(unitOfWork); signedInUsername = HttpContext.Current.User.Identity.Name; }
public PaymentsController(string oneUsername) { FailIfUsernameArgumentIsNull(oneUsername); TodoPagosContext context = new TodoPagosContext(); IUnitOfWork unitOfWork = new UnitOfWork(context); paymentService = new PaymentService(unitOfWork); signedInUsername = oneUsername; }
public ProvidersController(string oneUsername) { FailIfUsernameIsNull(oneUsername); TodoPagosContext context = new TodoPagosContext(); IUnitOfWork unitOfWork = new UnitOfWork(context); signedInUsername = oneUsername; providerService = new ProviderService(unitOfWork); }
public PrincipalForm() { InitializeComponent(); TodoPagosContext context = new TodoPagosContext(); unitOfWork = new UnitOfWork(context); logStrategy = new LogDatabaseConcreteStrategy(unitOfWork); todoPagosFacade = new LoginFacade(unitOfWork); }
public EarningQueriesController(string oneUsername) { FailIfUsernameArgumentIsNull(oneUsername); TodoPagosContext context = new TodoPagosContext(); IUnitOfWork unitOfWork = new UnitOfWork(context); earningQueriesService = new EarningQueriesService(unitOfWork); signedInUsername = oneUsername; }
public ClientsController(string username) { MakeSureUsernameIsNotNullOrWhiteSpace(username); TodoPagosContext context = new TodoPagosContext(); IUnitOfWork unitOfWork = new UnitOfWork(context); clientService = new ClientService(unitOfWork); signedInUsername = username; }
private void LogThisLoginInDatabase(string email) { TodoPagosContext databaseContext = new TodoPagosContext(); IUnitOfWork unitOfWork = new UnitOfWork(databaseContext); ILogStrategy log = new LogDatabaseConcreteStrategy(unitOfWork); LogEntry entry = new LogEntry(ActionType.LOGIN, email); log.SaveEntry(entry); unitOfWork.Dispose(); }
public void BeAbleToDeleteAnObject() { User user = new User("Bruno", "*****@*****.**", "Hola111!!!", AdminRole.GetInstance()); TodoPagosContext context = new TodoPagosContext(); GenericRepository <User> repository = new GenericRepository <User>(context); repository.Insert(user); repository.Delete(user); Assert.IsNull(repository.GetByID(0)); }
public void BeAbleToUpdateAnObject() { User user = new User("Bruno", "*****@*****.**", "Hola111!!!", AdminRole.GetInstance()); User modifiedUser = new User("Anselmo", "*****@*****.**", "Hola111!!!", AdminRole.GetInstance()); TodoPagosContext context = new TodoPagosContext(); GenericRepository <User> repository = new GenericRepository <User>(context); repository.Insert(user); repository.Update(modifiedUser); Assert.AreEqual("Anselmo", repository.GetByID(0).Name); }
public override Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context) { context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] { "*" }); using (TodoPagosContext db = new TodoPagosContext()) { var user = db.Users.FirstOrDefault(u => u.Email == context.UserName); if (user == null || !Hashing.VerifyHash(context.Password, user.Salt, user.Password)) { context.SetError("invalid_grant", "The user name or password is incorrect."); return(Task.FromResult <Object>(null)); } } var identity = new ClaimsIdentity(context.Options.AuthenticationType); identity.AddClaim(new Claim(ClaimTypes.Name, context.UserName)); context.Validated(identity); LogThisLoginInDatabase(context.UserName); return(Task.FromResult <Object>(null)); }
public void FailIfTodoPagosContextOnCreationIsNull() { TodoPagosContext context = null; UnitOfWork unitOfWork = new UnitOfWork(context); }
public UnitOfWork(TodoPagosContext todoPagosContext) { CheckForNullTodoPagosContext(todoPagosContext); context = todoPagosContext; }
public void FailIfTodoPagosContextOnCreationIsNull() { TodoPagosContext context = null; GenericRepository <User> repository = new GenericRepository <User>(context); }
public GenericRepository(TodoPagosContext context) { CheckForNullContext(context); this.context = context; this.dbSet = context.Set <TEntity>(); }