public async Task <IQRScanResponse> GetUserDataByQrCodeAsync(string qrCode) { attendee at = new attendee(); try { //var user = await _appDbContext.Users.FirstOrDefaultAsync(x => x.Id == userId); char[] spearator = { '-' }; var Scans = qrCode.Split(spearator); var item = await _appDbContext.Profiles.FirstOrDefaultAsync(e => e.QRCode == Scans[1]); if (item == null) { return(new QRScanResponse(ClientMessageConstant.InvalidQRCode, HttpStatusCode.NotFound)); } else { var attendeeName = await _appDbContext.Users.Where(x => x.Id == item.Id).FirstOrDefaultAsync(); if (attendeeName != null) { at.ProfileId = item.Id; at.NameEn = (attendeeName.NameEn != null) ? attendeeName.NameEn : ""; at.NameAr = (attendeeName.NameAr != null) ? attendeeName.NameAr : ""; var RprofileDesignation = _appDbContext.ProfileWorkExperiences.Include(k => k.Title).FirstOrDefault(k => k.ProfileId == attendeeName.Id); if (RprofileDesignation != null) { at.TitleEn = RprofileDesignation.Title?.TitleEn; at.TitleAr = RprofileDesignation.Title?.TitleAr; } if (attendeeName.OriginalImageFileId != null) { at.ImageURL = ConstantUrlPath.ProfileImagePath + attendeeName.OriginalImageFileId; } } return(new QRScanResponse(at)); } } catch (Exception e) { return(new QRScanResponse(e)); } //throw new NotImplementedException(); }
public async Task <IQRScanResponse> GetUserDataByshortCodeAsync(string shortCode) { attendee at = new attendee(); try { var Scans = (shortCode != "" && shortCode != null) ? Convert.ToInt32(shortCode) : 0; Scans = (Scans != 0) ? Scans + 100 : Scans; var item = await _appDbContext.Profiles.FirstOrDefaultAsync(e => e.Id == Scans); if (item == null) { return(new QRScanResponse(ClientMessageConstant.InvalidShortCode, HttpStatusCode.NotFound)); } else { var attendeeName = await _appDbContext.Users.Where(x => x.Id == item.Id).FirstOrDefaultAsync(); if (attendeeName != null) { at.ProfileId = item.Id; at.NameEn = (attendeeName.NameEn != null) ? attendeeName.NameEn : ""; at.NameAr = (attendeeName.NameAr != null) ? attendeeName.NameAr : ""; var RprofileDesignation = _appDbContext.ProfileWorkExperiences.Include(k => k.Title).FirstOrDefault(k => k.ProfileId == attendeeName.Id); if (RprofileDesignation != null) { at.TitleEn = RprofileDesignation.Title?.TitleEn; at.TitleAr = RprofileDesignation.Title?.TitleAr; } if (attendeeName.OriginalImageFileId != null) { at.ImageURL = ConstantUrlPath.ProfileImagePath + attendeeName.OriginalImageFileId; } } return(new QRScanResponse(at)); } } catch (Exception e) { return(new QRScanResponse(e)); } }
public QRScanResponse(attendee userView) : this(true, string.Empty, userView) { }
private QRScanResponse(bool success, string message, attendee view) : base(success, message) { UserView = view; }