Ejemplo n.º 1
0
        public async Task <IActionResult> EditProfile(CareerModel career, IFormFile fileUser, string Gender)
        {
            if (Gender == "male")
            {
                career.Gender = true;
            }
            else
            {
                career.Gender = false;
            }

            if (fileUser != null && fileUser.Length > 0)
            {
                string filePath = Path.Combine("wwwroot/images", fileUser.FileName);
                if (!System.IO.File.Exists(filePath))
                {
                    var stream = new FileStream(filePath, FileMode.Create);
                    await fileUser.CopyToAsync(stream);
                }

                career.Photo = "images/" + fileUser.FileName;
            }

            var edit_carrer = await services.EditProfile(career);

            if (edit_carrer != null)
            {
                return(RedirectToAction("index", "Career"));
            }



            return(View());
        }