public QrCodeController(QrCodeService qrCodeservice, BusService busService, UserService userService, RidesService ridesService) { this.qrCodeService = qrCodeservice; this.busService = busService; this.userService = userService; this.ridesService = ridesService; }
public ActionResult Generate(string message) { var qrService = new QrCodeService(); var qrCode = qrService.CreateQrCode(message); var byteArray = ImageToByteArray(qrCode); return(File(byteArray, "image/jpeg")); }
public void SetUp() { productService = new DefaultProductService(); distributorService = new DefaultDistributorService(); qrcodeService = new DefaultQrCodeService(); bindingService = new DefaultBindingService(); applicationContext = new ApplicationContext(); applicationContext.ConfigureHibernateMapping(); }
public async Task <IActionResult> Add([FromBody] PersonCreationBindingModel bm) { var person = await _personsRepo.Create(bm.FirstName, bm.LastName, bm.Phone); var response = Mapper.Map <PersonViewModel>(person); response.QrUrl = QrCodeService.GenerateQrCode(person.Id.ToString()); return(Created(response)); }
public async Task <IActionResult> CheckPerson(string phoneNumber = null) { var person = await _personsRepo.GetByPhone(phoneNumber); if (person == null) { return(NotFound()); } var response = Mapper.Map <PersonViewModel>(person); response.QrUrl = QrCodeService.GenerateQrCode(person.Id.ToString()); return(Ok(response)); }
public RecipesController(IRecipeRepository recipeRepository, QrCodeService qrCodeService) { this._recipeRepository = recipeRepository; this._qrCodeService = qrCodeService; }
public RecipeQrCodesController(QrMailSender qrMailSender, QrCodeService qrCodeService) { this._qrMailSender = qrMailSender; this._qrCodeService = qrCodeService; }
public void InitializationQrCodeService() { _qrCodeService = new QrCodeService(); _productBuilder = new ProductBuilder(); }
public static void ConfigureMappings(TypeAdapterConfig config) { config.NewConfig <Seat, SeatViewModel>(); config.NewConfig <Admin, AdminViewModel>() .Map(x => x.Id, y => y.Id.ToString()); config.NewConfig <Newcomer, NewcomerViewModel>() .Map(x => x.Id, y => y.Id.ToString()); config.NewConfig <Attendee, AttendeeViewModel>() .Map(x => x.Id, y => y.Id.ToString()) .Map(x => x.SeatAssigned, y => y.SeatNumber.HasValue ? y.SeatNumber.Value.ToString() : y.SeatAssigned); config.NewConfig <DateSummaryDto, DateSummaryViewModel>() .AfterMapping((x, y) => { y.HumanReadableDate = y.Date.ToString("ddd, dd MMM yyyy"); }); config.NewConfig <Person, BasePersonViewModel>() .Map(x => x.Id, y => y.Id.ToString()); config.NewConfig <Person, PersonViewModel>() .Inherits <Person, BasePersonViewModel>() .Ignore(x => x.QrUrl) .Map(x => x.FullName, y => $"{y.FirstName} {y.LastName}".Trim()); config.NewConfig <Venue, BaseVenueViewModel>() .Map(x => x.Id, y => y.Id.ToString()) .Map(x => x.NumOfSeats, y => y.Seats.Count); config.NewConfig <Venue, VenueViewModel>() .Inherits <Venue, BaseVenueViewModel>(); config.NewConfig <EventSeat, EventSeatViewModel>() .Map(x => x.VenueId, y => y.VenueId.ToString()); config.NewConfig <Event, BaseEventViewModel>() .Map(x => x.Id, y => y.Id.ToString()) .AfterMapping((model, vm) => { var sum = model.OnlineAttendance.Count(); sum += model.AssignedSeats .Count(x => x.Category == SeatCategory.Single); sum += model.AssignedSeats .Count(x => x.Category == SeatCategory.Couples); vm.NumOfAttendees = sum; }); config.NewConfig <Event, EventViewModel>() .Inherits <Event, BaseEventViewModel>() .Map(x => x.DurationInMinutes, y => Convert.ToInt32((y.EndsAt - y.StartsAt).TotalMinutes)) .Map(x => x.IsRegistrationClosed, y => y.IsRegistrationClosed()) .AfterMapping((model, vm) => { vm.RegistrationUrlQrCode = QrCodeService.GenerateQrCode(model.RegistrationUrl); // map seats vm.AvailableSeats = model.AvailableSeats .GroupBy(x => x.VenueId) .Select(x => { var venueId = x.Key; var venueName = x.First().VenueName; var seats = x.Select(y => new SeatViewModel { Category = y.Category, AssociatedNumber = y.AssociatedNumber, Number = y.Number }).ToList(); return(new VenueViewModel { Id = venueId.ToString(), Name = venueName, NumOfSeats = seats.Count, Seats = seats }); }) .ToList(); }); config.NewConfig <EventAttendeeDto, EventAttendeeViewModel>(); }
public DefaultBindingService() { productService = new DefaultProductService(); distributorService = new DefaultDistributorService(); qrCodeService = new DefaultQrCodeService(); }
public QrCodeSynchronizer() { qrCodeService = new DefaultQrCodeService(); }