Ejemplo n.º 1
0
        public Object GetIdentificationVerification()
        {
            var identification = dc.Table <UserIdentification>().FirstOrDefault(x => x.UserId == CurrentUserId);

            var frontSidePhoto = (from us in dc.Table <UserDocument>()
                                  join fs in dc.Table <FileStorage>() on us.FileStorageId equals fs.Id
                                  where us.UserId == CurrentUserId && us.Tag == "FrontSidePhotoId"
                                  orderby us.UpdatedTime descending
                                  select new { Name = fs.OriginalFileName, fs.Size, fs.ConvertedFileName }).FirstOrDefault();

            var backSidePhoto = (from us in dc.Table <UserDocument>()
                                 join fs in dc.Table <FileStorage>() on us.FileStorageId equals fs.Id
                                 where us.UserId == CurrentUserId && us.Tag == "BackSidePhotoId"
                                 orderby us.UpdatedTime descending
                                 select new { Name = fs.OriginalFileName, fs.Size, fs.ConvertedFileName }).FirstOrDefault();

            var storage = new FileStorageCore(dc, CurrentUserId);

            return(new
            {
                DocumentNumber = identification?.DocumentNumber,
                DocumentTypeId = identification?.DocumentTypeId,
                ExpiryDate = identification?.ExpiryDate,
                IssueDate = identification?.IssueDate,
                FrontSidePhoto = new
                {
                    frontSidePhoto?.Name,
                    frontSidePhoto?.Size,
                    Path = (frontSidePhoto?.ConvertedFileName == null) ? "" : storage.GetFilePath(frontSidePhoto.ConvertedFileName)
                },
                BackSidePhoto = new
                {
                    backSidePhoto?.Name,
                    backSidePhoto?.Size,
                    Path = (backSidePhoto?.ConvertedFileName == null) ? "" : storage.GetFilePath(backSidePhoto.ConvertedFileName)
                }
            });
        }
Ejemplo n.º 2
0
        public IActionResult GetDocumentSignature()
        {
            var file = (from us in dc.Table <UserDocument>()
                        join fs in dc.Table <FileStorage>() on us.FileStorageId equals fs.Id
                        where us.UserId == CurrentUserId && us.Tag == "DocumentSignature"
                        orderby us.UpdatedTime descending
                        select new { Name = fs.OriginalFileName, fs.Size, fs.ConvertedFileName }).FirstOrDefault();

            var storage = new FileStorageCore(dc, CurrentUserId);

            return(Ok(new
            {
                file?.Name,
                file?.Size,
                Path = (file?.ConvertedFileName == null) ? "" : storage.GetFilePath(file.ConvertedFileName)
            }));
        }