Exemplo n.º 1
0
        private void OnViewBreweryRemoveBeer(object sender, IIdentifiableEventArgs <int> e)
        {
            var id     = e.Id;
            var result = this.BreweryService.DeleteBeer(id);

            this.HandleResult(result, BeerDeletedSuccessMessage);
        }
        private void OnViewInitialized(object sender, IIdentifiableEventArgs <string> e)
        {
            var user = this.UserService.GetById(e?.Id);

            if (user == null)
            {
                this.View.ErrorMessageText    = "User not found!";
                this.View.ErrorMessageVisible = true;
            }
            else
            {
                this.View.Model.User    = user;
                this.View.Model.Reviews = user.BeerReviews;
            }
        }
Exemplo n.º 3
0
        private void OnViewInitialise(object sender, IIdentifiableEventArgs <int> e)
        {
            var id     = e.Id;
            var review = this.ReviewService.GetById(id);

            if (review != null)
            {
                this.View.Model.Review    = review;
                this.View.NotFoundVisible = false;
            }
            else
            {
                this.View.NotFoundVisible = true;
            }
        }
Exemplo n.º 4
0
        private void OnViewInitialized(object sender, IIdentifiableEventArgs <string> e)
        {
            var id = e.Id;
            int intId;
            var isValidId = int.TryParse(id, out intId);

            if (isValidId)
            {
                var brewery = this.BreweryService.GetById(intId);
                if (brewery == null)
                {
                    this.ShowError(NotFoundMessage);
                }
                else
                {
                    this.View.Model.Brewery = brewery;
                }
            }
            else
            {
                this.ShowError(NotFoundMessage);
            }
        }
        private void OnViewRemoveAdmin(object sender, IIdentifiableEventArgs <string> e)
        {
            var result = this.UserService.RemoveAdmin(e.Id);

            this.ProcessResult(result, "Administrator removed.");
        }
        private void OnViewMakeAdmin(object sender, IIdentifiableEventArgs <string> e)
        {
            var result = this.UserService.MakeAdmin(e.Id);

            this.ProcessResult(result, "User is now an administrator.");
        }
        private void OnViewEnableUser(object sender, IIdentifiableEventArgs <string> e)
        {
            var result = this.UserService.EnableUser(e.Id);

            this.ProcessResult(result, "User has been enabled!");
        }
        private void OnViewDisableUser(object sender, IIdentifiableEventArgs <string> e)
        {
            var result = this.UserService.DisableUser(e.Id);

            this.ProcessResult(result, "User locked out!");
        }