public GroupPostViewComponent(IUserHelper userHelper, IConfiguration configuration, IPsSelectList psSelectList, ApplicationDbContext context) { UserHelper = userHelper; Configuration = configuration; PsSelectList = psSelectList; _context = context; GenericSelectList = new GenericSelectList(); }
public PsBaseController(ApplicationDbContext context, IUserHelper userHelper, ICurrentUserFactory currentUser) { Context = context; UserHelper = userHelper; GenericSelectList = new GenericSelectList(); MyCurrentUser = currentUser; }
public PsBaseController(IUserHelper userHelper, IConfiguration configuration, IPsSelectList psSelectList) { UserHelper = userHelper; Configuration = configuration; PsSelectList = psSelectList; GenericSelectList = new GenericSelectList(); }
// 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); }
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)); }
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(); }
public CitiesController(AppContext context) { _context = context; _genericSelectList = new GenericSelectList(); }