예제 #1
0
        public IActionResult Create(CreatePeopleViewModel model)
        //public RedirectToActionResult Create(People people)
        {
            if(ModelState.IsValid)
            {
                string uniqueFileName = ProcessUploadedFile(model);

                People newPeople = new People
                {
                    Name = model.Name,
                    Email = model.Email,
                    Department = model.Department,
                    // Store the file name in PhotoPath property of the employee object
                    // which gets saved to the Employees database table
                    PhotoPath = uniqueFileName
                };




                _people.AddPeople(newPeople);
            return RedirectToAction("Index",new { id= newPeople.Id });
            }
            return View();

        }