コード例 #1
0
 public Service(IRepositoryRezervare repoRezervare, IRepositoryUser repoUsers, IRepositoryExcursie repoExcursie)
 {
     loggedClients      = new Dictionary <String, IObserver>();
     this.repoRezervare = repoRezervare;
     this.repoUsers     = repoUsers;
     this.repoExcursie  = repoExcursie;
 }
コード例 #2
0
 public AdminCompanyGoodsController(IRepositoryUser repositoryUser, IRepositoryCompany repositoryCompany, IRepositoryGood repositoryGood, IRepositoryImage repositoryImage)
 {
     _repositoryUser    = repositoryUser;
     _repositoryCompany = repositoryCompany;
     _repositoryGood    = repositoryGood;
     _repositoryImage   = repositoryImage;
 }
コード例 #3
0
        public async Task <IActionResult> Watchlist([FromServices] IRepositoryUser repoUser)
        {
            List <WatchlistItems> searchedSymbols = new List <WatchlistItems>();
            var watchlist = repoUser.RetrieveUserWatchlist();
            var symbols   = watchlist.Split(';');

            foreach (string sym in symbols)
            {
                var reqUri = "https://" + $@"www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=" + sym + "&apikey=" + _apiKey;
                using (var httpClient = new HttpClient())
                {
                    using (var response = await httpClient.GetAsync(reqUri))
                    {
                        string apiResponse = await response.Content.ReadAsStringAsync();

                        dynamic        data       = JsonConvert.DeserializeObject(apiResponse);
                        var            count      = data.bestMatches.Count;
                        var            firstMatch = data.bestMatches[0];
                        WatchlistItems wl         = (JsonConvert.DeserializeObject <WatchlistItems>(firstMatch.ToString()));
                        searchedSymbols.Add(wl);
                    }
                }
            }
            return(View(searchedSymbols));
            //return View(model);
        }
コード例 #4
0
        public ActionResult Login(UserLogin user)
        {
            User userFromDB;

            rep = new RepositoryUserDB();
            rep.Open();
            userFromDB = rep.Login(user);
            rep.Close();
            // Username und Passwort stimmen nicht mit den BD-Daten überein

            if (userFromDB == null)
            {
                ModelState.AddModelError("Username", "Benutzername, Passwort oder Rolle stimmen nicht überein!");
                return(View(user));
            }

            // Daten stimmen mit DB-Werten überein
            else
            {
                // der komplette User wird in einer Sessionvariable abgelegt
                // und ist somit auf jeder Seite verfügbar
                Session["loggedinUser"] = userFromDB;
                return(RedirectToAction("index", "home"));
            }
        }
コード例 #5
0
 public ServiceVideo(IRepositoryUser repositoryUser, IRepositoryChannel repositoryChannel, IRepositoryPlayList repositoryPlayList, IRepositoryVideo repositoryVideo)
 {
     _repositoryUser     = repositoryUser;
     _repositoryChannel  = repositoryChannel;
     _repositoryPlayList = repositoryPlayList;
     _repositoryVideo    = repositoryVideo;
 }
コード例 #6
0
 public BusinessCustomer(IUnityOfWork uow, IRepositoryCustomer repositoryCustomer, IRepositoryAddress repositoryAddress, IRepositoryUser repUser)
     : base(uow)
 {
     _repAddress  = repositoryAddress;
     _repCustomer = repositoryCustomer;
     _repUser     = repUser;
 }
コード例 #7
0
 public CartController(IRepositoryUser user, ICartProductsRepository cartProdrepo, IProductDetailsRepo product, ICartRepository cart)
 {
     _user         = user;
     _cartProdrepo = cartProdrepo;
     _product      = product;
     _cart         = cart;
 }
コード例 #8
0
        public void Init(HttpApplication context)
        {
            context.AuthenticateRequest += OnApplicationAuthenticateRequest;
            context.EndRequest          += OnApplicationEndRequest;

            this._repositoryUser = DependencyInjector.Container.BeginLifetimeScope().Resolve <IRepositoryUser>();
        }
コード例 #9
0
        public ActionResult Registration(User user)
        {
            if (user == null)
            {
                return(View(user));
            }

            CheckUserData(user);

            if (!ModelState.IsValid)
            {
                return(View(user));
            }
            else
            {
                user.UserRole = UserRole.registeredUser;

                rep = new RepositoryUser();

                rep.Open();
                if (rep.Insert(user))
                {
                    rep.Close();
                    return(RedirectToAction("Login"));
                }
                else
                {
                    rep.Close();
                    return(View(user));
                }
            }
        }
コード例 #10
0
        public ActionResult DeleteRegisteredUser(int idUser)
        {
            if (Session["loggedInUser"] == null)
            {
                return(RedirectToAction("login", "admin"));
            }

            if (!Convert.ToBoolean(Session["isAdmin"]))
            {
                return(RedirectToAction("index", "home"));
            }

            rep = new RepositoryUser();

            rep.Open();
            if (rep.Delete(idUser))
            {
                rep.Close();
                return(RedirectToAction("RegisteredUsers", "admin"));
            }
            else
            {
                rep.Close();
                return(View("Message", new Message("Löschen", "Löschen war nicht erfolgreich")));
            }
        }
コード例 #11
0
        public ActionResult Login(UserLogin user)
        {
            User userFromDB;

            rep = new RepositoryUser();
            rep.Open();
            userFromDB = rep.Login(user);
            rep.Close();

            if (userFromDB == null)
            {
                ModelState.AddModelError("Username", "Benutzername oder Passwort stimmen nicht überein!");
                return(View(user));
            }
            else
            {
                Session["loggedInUser"] = userFromDB;

                if (userFromDB.UserRole == UserRole.admin)
                {
                    Session["isAdmin"] = true;
                }
                else
                {
                    Session["isAdmin"] = false;
                }


                return(RedirectToAction("index", "home"));
            }
        }
コード例 #12
0
        public ActionResult RegisteredUsers()
        {
            if (Session["loggedInUser"] == null)
            {
                return(RedirectToAction("login", "admin"));
            }

            if (!Convert.ToBoolean(Session["isAdmin"]))
            {
                return(RedirectToAction("index", "home"));
            }

            List <User> users;

            rep = new RepositoryUser();

            rep.Open();
            users = rep.GetAllUsers();
            rep.Close();

            List <User> registeredUsersOnly = new List <User>();

            foreach (var u in users)
            {
                if (u.UserRole == UserRole.registeredUser)
                {
                    registeredUsersOnly.Add(u);
                }
            }

            return(View(registeredUsersOnly));
        }
コード例 #13
0
 public ServiceVideo(IRepositoryUser repositoryUser, IRepositoryVideo repositoryVideo, IRepositoryCanal repositoryCanal, IRepositoryPlayList repositoryPlayList)
 {
     _repositoryUser     = repositoryUser;
     _repositoryVideo    = repositoryVideo;
     _repositoryCanal    = repositoryCanal;
     _repositoryPlayList = repositoryPlayList;
 }
コード例 #14
0
        public ActionResult Registration(User user)
        {
            if (user == null)
            {
                return(RedirectToAction("Registration"));
            }

            CheckUserData(user);

            if (!ModelState.IsValid)
            {
                return(View(user));
            }
            else
            {
                rep = new RepositoryUserDB();

                //eine Verbindung zum DB server herstellen
                rep.Open();
                //versuchen, die Userdaten einzutragen
                if (rep.Insert(user))
                {
                    return(View("Message", new Message("Registrierung", "Ihre Daten wurden erfolgreich abgespeichert")));
                }
                else
                {
                    //verbindung schließen
                    rep.Close();
                    return(View("Message", new Message("Registrierung", "Ihre Daten konnten nicht gespeichert werden")));
                }

                //nun würden wir die Daten in einer DatenBank abspeichern
            }
        }
コード例 #15
0
 public UserStatisticService(
     IRepositoryUser repositoryUser,
     IHistoryTripService historyTripService)
 {
     _repositoryUser     = repositoryUser;
     _historyTripService = historyTripService;
 }
コード例 #16
0
        public async Task <IActionResult> Index([FromServices] IRepositoryUser repoUser)
        {
            //var model = await _context.Users.ToArrayAsync();
            var model = repoUser.UsersWithAccountRole();

            return(View(model));
        }
コード例 #17
0
ファイル: Service.cs プロジェクト: laurentiu-rusu/Festivals
        public Service(IRepositoryConcert repositoryConcert, IRepositoryTicket repositoryTicket, IRepositoryUser repositoryUser)
        {
            _repositoryConcert = repositoryConcert;
            _repositoryTicket  = repositoryTicket;
            _repositoryUser    = repositoryUser;

            connectedClients = new Dictionary <string, IObserver>();
        }
コード例 #18
0
ファイル: UnitOfWork.cs プロジェクト: InfoRaulGG/Critipedia
 public UnitOfWork(string connectionString)
 {
     RepositorySubcategorias = new RepositorySubcategorias(connectionString);
     RepositoryUser          = new RepositoryUser(connectionString);
     RepositoryCategorias    = new RepositoryCategorias(connectionString, RepositorySubcategorias);
     RepositoryComentarios   = new RepositoryComentarios(connectionString, RepositoryUser);
     RepositoryCriticas      = new RepositoryCriticas(connectionString, RepositoryComentarios);
 }
コード例 #19
0
ファイル: AuthService.cs プロジェクト: SD-Team/E-Learning
 public AuthService(IRepositoryUser <TB_EB_USER, string> repositoryTB_EB_USER,
                    DBContextUser contextUser,
                    IRepositoryVideo <TB_EL_System_Role, string> repositoryTB_EL_System_Role)
 {
     _repositoryTB_EB_USER        = repositoryTB_EB_USER;
     _contextUser                 = contextUser;
     _repositoryTB_EL_System_Role = repositoryTB_EL_System_Role;
 }
コード例 #20
0
 public AdminController(IRepositoryUser repositoryUser,
                        ICheckUserExist exist, ILogger logger, IReadFromBrowser read)
 {
     _repositoryUser = repositoryUser;
     _check          = exist;
     _logger         = logger;
     _read           = read;
 }
コード例 #21
0
        public AccountController(IRepositoryUser userRepo, IRepositoryEmployee emplRepo, IRepositoryQueue queueRepo, IQueueHub hub)
        {
            _userRepository     = userRepo;
            _employeeRepository = emplRepo;

            _queueRepository = queueRepo;
            _hub             = hub;
        }
コード例 #22
0
 public void Setup()
 {
     this.user = new User {
         Email = "*****@*****.**", Password = "******", Username = "******"
     };
     this.userRepository = A.Fake <IRepositoryUser>();
     this.userService    = A.Fake <UserServices>();
     this.userService    = new UserServices(this.userRepository);
 }
コード例 #23
0
        public void SetUp()
        {
            this.InitializeProduct();

            this.productRepository = A.Fake <IRepositoryProduct>();
            this.userRepository    = A.Fake <IRepositoryUser>();

            this.productService = new ProductServices(this.productRepository, this.userRepository);
        }
コード例 #24
0
 public void OneTimeSetup()
 {
     _repositoryHelper = new RepositoryHelper();
     _repositoryHelper.FillTypes.AddAll(new[]
     {
         EntityType.User, EntityType.Address, EntityType.City, EntityType.Role
     });
     _repositoryUser = _repositoryHelper.RepositoryFactory.CreateRepositoryUser();
 }
コード例 #25
0
        public ActionResult UserData(User user)
        {
            if (user == null)
            {
                return(View(user));
            }


            if (user.Password == null || user.Password == "")
            {
                CheckUserDataWithoutPassword(user);
            }
            else
            {
                CheckUserData(user);
            }

            if (!ModelState.IsValid)
            {
                return(View(user));
            }
            else
            {
                user.UserRole = ((User)Session["loggedInUser"]).UserRole;

                rep = new RepositoryUser();

                rep.Open();
                if (user.Password == null || user.Password == "")
                {
                    if (rep.UpdateUserDataWithoutPassword(((User)Session["loggedInUser"]).ID, user))
                    {
                        rep.Close();
                        return(View(user));
                    }
                    else
                    {
                        rep.Close();
                        return(View(user));
                    }
                }
                else
                {
                    if (rep.UpdateUserData(user.ID, user))
                    {
                        rep.Close();
                        return(View(user));
                    }
                    else
                    {
                        rep.Close();
                        return(View(user));
                    }
                }
            }
        }
コード例 #26
0
        public void Insert_ShouldInvokeProductRepository_WithGivenProduct()
        {
            this.user.Product   = null;
            this.userRepository = A.Fake <UserRepository>();
            A.CallTo(() => this.userRepository.GetUserWithProducts(this.user.Id)).Returns(this.user);

            this.productService.Insert(this.product);

            A.CallTo(() => this.productRepository.Insert(this.product)).MustHaveHappened();
        }
コード例 #27
0
 public ProductController(IRepositoryProducts repositoryProducts,
                          IRepositoryUser user, IReadFromBrowser read,
                          ICheckUserExist checkUser, ILogger logger)
 {
     _repositoryProducts = repositoryProducts;
     _repositoryUser     = user;
     _read   = read;
     _check  = checkUser;
     _logger = logger;
 }
コード例 #28
0
 public AccountService(UserManager <AppUser> userManager, IRepositoryUser repositoryUser,
                       SignInManager <AppUser> signInManager, RoleManager <IdentityRole> roleManager,
                       IMapper mapper)
 {
     this.mapper         = mapper;
     this.repositoryUser = repositoryUser;
     this.userManager    = userManager;
     this.roleManager    = roleManager;
     this.signInManager  = signInManager;
 }
コード例 #29
0
 public SystemManagementService(IRepositoryVideo <TB_EL_System_Role, long> repositoryTB_EL_System_Role,
                                IRepositoryUser <TB_EB_DOMAIN, long> repositoryTB_EB_DOMAIN,
                                IRepositoryUser <TB_EB_USER, string> repositoryTB_EB_USER,
                                DBContextUser contextUser)
 {
     _repositoryTB_EL_System_Role = repositoryTB_EL_System_Role;
     _repositoryTB_EB_DOMAIN      = repositoryTB_EB_DOMAIN;
     _repositoryTB_EB_USER        = repositoryTB_EB_USER;
     _contextUser = contextUser;
 }
コード例 #30
0
 public LoginController(IEmptyCart emptyCart, IRepositoryUser irepositoryUser,
                        IReadFromBrowser read, IWriteToBrowser write, IEmailManger email, ILogger logger)
 {
     _irepositoryUser = irepositoryUser;
     _read            = read;
     _write           = write;
     _emptyCart       = emptyCart;
     _sendEmail       = email;
     _logger          = logger;
 }
コード例 #31
0
ファイル: UserController.cs プロジェクト: Natashka92/OzonShop
 public UserController(IRepositoryUser repositoryUser)
 {
     this.repositoryUser = repositoryUser;
 }