public Film GetFilmsWatchlist(int id) { Gebruiker g = _gebruikerRepo.GetBy(User.Identity.Name); Film f = g.GetFilmWatchlistBy(id); return(f); }
public IEnumerable <Forum> GetFora(string filter, string followed) { IEnumerable <Forum> fora = _forumRepository.Fora(filter).OrderBy(f => f.Naam); if (followed != null && followed != "undefined" && followed != "") { fora = fora.Where(f => f.heeftLid(_gebruikerRepository.GetBy(User.Identity.Name))); } return(fora); }
public ActionResult <Gebruiker> GetGebruiker(string email) { Gebruiker gebruiker = _gebruikerRepository.GetBy(email); if (gebruiker == null) { return(NotFound()); } return(gebruiker); }
public ActionResult <GebruikerDTO> GetGebruikerViaID(string gebruikerId) { Gebruiker g = _gebruikerRepository.GetBy(gebruikerId); if (g == null) { return(NotFound()); } return(new GebruikerDTO(g)); }
public ActionResult <Gebruiker> GetGebruikerId(string gebruikerId) { Gebruiker g = _gebruikerRepository.GetBy(gebruikerId); if (g == null) { return(NotFound()); } return(g); }
public ActionResult <IEnumerable <WinkelwagenExportDTO> > GetWinkelwagensOfGebruiker() { Gebruiker g = _gebruikerRepository.GetBy(User.Identity.Name); if (g == null) { return(NotFound()); } return(g.Winkelwagens.OrderByDescending(t => t.Datum).Select(t => new WinkelwagenExportDTO(_winkelwagenRepository.GetBy(t.Id))).ToList()); }
public async Task <ActionResult <string> > LogUit() { Gebruiker user = _gebruikerRepository.GetBy(User.Identity.Name); if (user != null) { await _signInManager.SignOutAsync(); return(Ok("uitgelogd")); } return(BadRequest()); }
private async Task <Gebruiker> HaalGebruikerOp() { var gebruiker = _gebruikerRepository.GetBy("lekkerlokaal"); if (_signInManager.IsSignedIn(User)) { var user = await _userManager.GetUserAsync(User); if (_gebruikerRepository.GetBy(user.Email) != null) { gebruiker = _gebruikerRepository.GetBy(user.Email); } } return(gebruiker); }
public IActionResult RegistreerAanwezigheid(int lesmomentId, string gebruikersnaam) { try { Lesmoment lesmoment = lesmomentRepository.GetById(lesmomentId); Gebruiker gebruiker = gebruikerRepository.GetBy(gebruikersnaam); if (lesmoment.EersteHelftIsVoorbij()) { TempData["error"] = "De eerste helft van het lesmoment is al voorbij, u kan zelf niet meer aanwezig melden"; return(RedirectToRoute(new { controller = "Home", action = "Index" })); } else { if (gebruiker.Lesformule.TitleText.Count() > 8) //meerdere dagen formule => 5 punten { gebruiker.voegPuntenToe(5); } else { gebruiker.voegPuntenToe(10); //1 dag formule => 10 punten } gebruikerRepository.SaveChanges(); lesmoment.RegistreerLid(gebruiker); lesmomentRepository.Save(); return(RedirectToAction(nameof(Aanwezigheden))); } } catch { return(RedirectToAction("Error", "Home")); } }
public ActionResult <IEnumerable <Commentaar> > GetCommentaarVanSpefiekeDagEnGebruiker(string zaterdagDatum, string zondagDatum, string gebruikerId) { DateTime datumFormattedZat = DateTime.Parse(zaterdagDatum, null, System.Globalization.DateTimeStyles.RoundtripKind); DateTime datumFormattedZon = DateTime.Parse(zondagDatum, null, System.Globalization.DateTimeStyles.RoundtripKind); Gebruiker huidigeGebruiker = _gebruikerRepository.GetBy(gebruikerId); ICollection <Commentaar> commentaarlijst = new List <Commentaar>(); commentaarlijst.Add(_commentaarRepository.GetCommentaarByDatumEnGebruiker(huidigeGebruiker.Id, datumFormattedZat)); commentaarlijst.Add(_commentaarRepository.GetCommentaarByDatumEnGebruiker(huidigeGebruiker.Id, datumFormattedZon)); return(new OkObjectResult(commentaarlijst.ToList())); }
public async Task <IActionResult> Index() { ViewData["AlleCategorien"] = _categorieRepository.GetAll().ToList(); ViewData["Geslacht"] = Geslachten(); var user = await _userManager.GetUserAsync(User); if (user == null) { throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); } var gebruiker = _gebruikerRepository.GetBy(user.Email); var model = new IndexViewModel { Username = user.UserName, Email = user.Email, Voornaam = gebruiker.Voornaam, Familienaam = gebruiker.Familienaam, Geslacht = gebruiker.Geslacht, IsEmailConfirmed = user.EmailConfirmed, StatusMessage = StatusMessage }; return(View(model)); }
public IActionResult Dashboard() { try { TempData["leeromgeving"] = User.IsInRole("beheerder"); TempData["gebruiker"] = HttpContext.Session.GetString("Gebruiker"); TempData["proefles"] = _gebruikerRepository.GetBy(HttpContext.Session.GetString("Gebruiker")).TypeGebruiker.Equals(TypeGebruiker.Proefgebruiker); return(View()); } catch { return(RedirectToAction(nameof(Error))); } }
public IEnumerable <PictoDagDTO> GetWeekPictoAgendasVanClient(string datum, string gebruikerId) { Gebruiker gebruiker = _gebruikerRepository.GetBy(gebruikerId); if (gebruiker == null) { return(null); } DateTime tempdate = GetEersteDagVanWeek(datum); var pictodtos = new List <PictoDagDTO>(); for (int i = 0; i < 7; i++) { pictodtos.Add(GetPictoAgendaVanEenPersoon(tempdate.AddDays(i).ToString("yyyy/MM/dd"), gebruiker.Id).Value); } return(pictodtos.AsEnumerable()); }
public ActionResult <Post> PostPost(PostDTO post) { Gebruiker gebruiker = _gebruikerRepository.GetBy(User.Identity.Name); Post postToCreate = new Post() { Beschrijving = post.Beschrijving, Gebruiker = gebruiker, CategorieNaam = post.CategorieNaam }; foreach (var f in post.Fotos) { postToCreate.AddFoto(new Foto(f.Naam)); } _postRepository.Add(postToCreate); _postRepository.SaveChanges(); return(CreatedAtAction(nameof(GetPost), new { id = postToCreate.PostId }, postToCreate)); }
public void GeneratePDF(int Id) { var bestellijn = _bestellijnRepository.GetById(Id); var bon = _bonRepository.GetByBonId(bestellijn.Bon.BonId); var handelaar = _handelaarRepository.GetByHandelaarId(bon.Handelaar.HandelaarId); var user = _userManager.GetUserAsync(User); var gebruiker = _gebruikerRepository.GetBy(user.Result.Email); ViewData["path"] = @"/pdf/c_" + bestellijn.QRCode + ".pdf"; string waarde = String.Format("€ " + bestellijn.Prijs.ToString()); string verval = bestellijn.AanmaakDatum.AddYears(1).ToString("dd/MM/yyyy"); string geldigheid = String.Format("Geldig tot: " + verval); var pdf = new Document(PageSize.A5.Rotate(), 81, 225, 25, 0); //Paragraph bedrag = new Paragraph(waarde); //Paragraph p2 = new Paragraph(geldigheid); GenerateQR(bestellijn.QRCode); var imageURL = @"wwwroot/images/temp/" + bestellijn.QRCode + ".png"; iTextSharp.text.Image jpg = iTextSharp.text.Image.GetInstance(imageURL); jpg.ScaleToFit(145f, 145f); var logoURL = @"wwwroot/images/logo.png"; var logoURLHandelaar = @"wwwroot" + handelaar.GetLogoPath(); var kadoURL = @"wwwroot/images/kado.jpg"; iTextSharp.text.Image kado = iTextSharp.text.Image.GetInstance(kadoURL); iTextSharp.text.Image logoLL = iTextSharp.text.Image.GetInstance(logoURL); iTextSharp.text.Image logoHandelaar = iTextSharp.text.Image.GetInstance(logoURLHandelaar); //Paragraph naamBon = new Paragraph("Bon: " + bon.Naam); logoLL.SetAbsolutePosition(20, 15); logoLL.ScaleToFit(188f, 100f); logoHandelaar.ScaleToFit(188f, 100f); logoHandelaar.SetAbsolutePosition(410, 15); jpg.SetAbsolutePosition(225, 0); kado.SetAbsolutePosition(65, 161); iTextSharp.text.Font arial = FontFactory.GetFont("Arial", 23); iTextSharp.text.Font arial18 = FontFactory.GetFont("Arial", 14); iTextSharp.text.Font arialSmall = FontFactory.GetFont("Arial", 7); Paragraph bedrag = new Paragraph(waarde, arial); bedrag.SpacingAfter = 50; Paragraph naamHandelaar = new Paragraph(bon.Naam, arial); naamHandelaar.SpacingAfter = 0; Paragraph geschonkenDoor = new Paragraph("Geschonken door: " + gebruiker.Voornaam, arial18); Paragraph geldig = new Paragraph(geldigheid, arial18); bedrag.Alignment = Element.ALIGN_LEFT; naamHandelaar.Alignment = Element.ALIGN_LEFT; geschonkenDoor.Alignment = Element.ALIGN_LEFT; geldig.Alignment = Element.ALIGN_LEFT; Phrase qrCodeString = new Phrase(bestellijn.QRCode, arialSmall); PdfWriter writer = PdfWriter.GetInstance(pdf, new FileStream(@"wwwroot/pdf/c_" + bestellijn.QRCode + ".pdf", FileMode.Create)); pdf.Open(); ColumnText.ShowTextAligned(writer.DirectContent, Element.ALIGN_MIDDLE, qrCodeString, 195, 4, 0); pdf.Add(logoLL); pdf.Add(logoHandelaar); pdf.Add(naamHandelaar); pdf.Add(bedrag); pdf.Add(geschonkenDoor); pdf.Add(geldig); pdf.Add(jpg); pdf.Add(kado); pdf.Close(); System.IO.File.Delete(imageURL); }
public ActionResult <GebruikerDTO> GetGebruiker() { Gebruiker gebruiker = _gebruikerRepository.GetBy(User.Identity.Name); return(new GebruikerDTO(gebruiker)); }
public override void OnActionExecuting(ActionExecutingContext context) { try { context.ActionArguments["gebruiker"] = context.HttpContext.User.Identity.IsAuthenticated ? _gebruikerRepository.GetBy(context.HttpContext.Session.GetString("Gebruiker")) : null; base.OnActionExecuting(context); } catch { context.ActionArguments["gebruiker"] = null; base.OnActionExecuting(context); } }
public IEnumerable <Tuin> GetFavourites() { Gebruiker gebruiker = _gebruikerRepository.GetBy(User.Identity.Name); return(gebruiker.FavoriteTuinen); }
public override void OnActionExecuting(ActionExecutingContext context) { context.ActionArguments["gebruiker"] = context.HttpContext.User.Identity.IsAuthenticated ? _gebruikerRepository.GetBy(context.HttpContext.User.Identity.Name) : null; base.OnActionExecuting(context); }