Beispiel #1
0
        public async Task <object> UploadCV([FromForm] UpLoadCV fileCV)
        {
            UploadImage uploadImage = new UploadImage(_hostEnvironment);
            string      pathCV      = null;

            if (fileCV.CVFile != null)
            {
                pathCV = await uploadImage.SaveImage(fileCV.CVFile);
            }
            if (fileCV.OrdinalCVName != null && fileCV.CVFile != null)
            {
                await uploadImage.DeleteFile(fileCV.OrdinalCVName);
            }

            var           identity = HttpContext.User.Identity as ClaimsIdentity;
            IList <Claim> claims   = identity.Claims.ToList();
            var           result   = await _context.Database.ExecuteSqlRawAsync("dbo.UTE_Seeker_InsertOrUpdateCV " +
                                                                                "@CandidateCode={0},@PathCV={1},@RecID={2},@JobTitleID={3}," +
                                                                                "@Description={4},@IsPublic={5}",
                                                                                claims[5].Value,
                                                                                pathCV,
                                                                                fileCV.RecID,
                                                                                fileCV.JobTitleID,
                                                                                fileCV.Description,
                                                                                fileCV.IsPublic
                                                                                );

            IActionResult response = Unauthorized();

            if (result > 0)
            {
                response = Ok(new { Error = "" });
                return(response);
            }
            response = Ok(new { Error = "Có lỗi" });
            return(response);
        }