Exemplo n.º 1
0
        public async Task <IActionResult> AutomaticSyncProcess([FromBody] AddFileCommand.Contract request)
        {
            if (string.IsNullOrEmpty(request.SyncAppId))
            {
                return(this.Unauthorized());
            }

            request.FileContent = request.FileContent.Substring(request.FileContent.IndexOf(",", StringComparison.Ordinal) + 1);
            Byte[] bytes = Convert.FromBase64String(request.FileContent);
            using (Stream stream = new MemoryStream(bytes))
            {
                StreamReader reader = new StreamReader(stream);
                request.FileContent = reader.ReadToEnd();
            }

            var result = await this.Send(request);

            return(RestResult.CreateHttpResponse(result));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> AddUsersSyncProcess([FromBody] AddFileCommand.Contract request)
        {
            var role = this.GetUserRole();

            if (role != "Admin" && role != "HumanResources" && role != "Secretary" && role != "Recruiter")
            {
                return(this.Unauthorized());
            }

            request.FileContent = request.FileContent.Substring(request.FileContent.IndexOf(",", StringComparison.Ordinal) + 1);
            Byte[] bytes = Convert.FromBase64String(request.FileContent);
            using (Stream stream = new MemoryStream(bytes))
            {
                StreamReader reader = new StreamReader(stream);
                request.FileContent = reader.ReadToEnd();
            }

            var result = await this.Send(request);

            return(RestResult.CreateHttpResponse(result));
        }