Exemplo n.º 1
0
 public GroupPostViewComponent(IUserHelper userHelper, IConfiguration configuration, IPsSelectList psSelectList, ApplicationDbContext context)
 {
     UserHelper        = userHelper;
     Configuration     = configuration;
     PsSelectList      = psSelectList;
     _context          = context;
     GenericSelectList = new GenericSelectList();
 }
Exemplo n.º 2
0
 public PsBaseController(ApplicationDbContext context,
                         IUserHelper userHelper, ICurrentUserFactory currentUser)
 {
     Context           = context;
     UserHelper        = userHelper;
     GenericSelectList = new GenericSelectList();
     MyCurrentUser     = currentUser;
 }
Exemplo n.º 3
0
 public PsBaseController(IUserHelper userHelper,
                         IConfiguration configuration,
                         IPsSelectList psSelectList)
 {
     UserHelper        = userHelper;
     Configuration     = configuration;
     PsSelectList      = psSelectList;
     GenericSelectList = new GenericSelectList();
 }
Exemplo n.º 4
0
        // private readonly ApplicationDbContext _context;

        public GroupsController(IGroup groupRepository,
                                IUserHelper userHelper,
                                ApplicationDbContext context, IConfiguration configuration)
        {
            _groupRepository   = groupRepository;
            _userHelper        = userHelper;
            _configuration     = configuration;
            _genericSelectList = new GenericSelectList();
            _privacyRepo       = new Repository <Privacy>(context);
            _groupTypeRepo     = new Repository <GroupType>(context);
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Create()
        {
            var groupTypes = await PsSelectList.GetListGroupTypes();

            var privacies = await PsSelectList.GetListPrivacies();

            var group = new GroupViewModel
            {
                Privacies  = GenericSelectList.CreateSelectList(privacies, x => x.Id, x => x.Name),
                GroupTypes = GenericSelectList.CreateSelectList(groupTypes, x => x.Id, x => x.Name)
            };

            return(View(group));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Edit(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var group = await _groupRepository.GetGroupWithPostsAndComments(id.Value);

            if (group == null)
            {
                return(NotFound());
            }

            if (group.Owner.Email != User.Identity.Name)
            {
                return(Unauthorized());
            }

            var groupTypes = await PsSelectList.GetListGroupTypes();

            var privacies = await PsSelectList.GetListPrivacies();


            var pList = GenericSelectList.CreateSelectList(privacies, x => x.Id, x => x.Name);

            var vm = new GroupViewModel
            {
                Name         = group.Name,
                Description  = group.Description,
                Link         = group.Link,
                CreationDate = group.CreationDate,
                PictureUrl   = group.PictureUrl,
                Type         = group.Type,
                Privacy      = group.Privacy,
                Owner        = group.Owner,
                TypeId       = group.Type.Id,
                PrivacyId    = group.Privacy.Id,
                Id           = group.Id,
                Privacies    = pList,
                GroupTypes   = GenericSelectList.CreateSelectList(groupTypes, x => x.Id, x => x.Name)
            };

            return(View(vm));
        }
 public ProductsController(AppContext context)
 {
     _context           = context;
     _genericSelectList = new GenericSelectList();
 }
Exemplo n.º 8
0
 public CitiesController(AppContext context)
 {
     _context           = context;
     _genericSelectList = new GenericSelectList();
 }