コード例 #1
0
 public IActionResult Create(Person person, string returnUrl, IFormFile file = null)
 {
     if (ModelState.IsValid)
     {
         if (file == null)
         {
             person.ImgLink = "http://all4desktop.com/data_images/original/4242435-face.jpg";
         }
         _context.People.Add(person);
         _context.SaveChanges();
         if (file != null)
         {
             person = this.savePhoto(person, file);
             _context.Update(person);
             _context.SaveChanges();
         }
         if (Url.IsLocalUrl(returnUrl))
         {
             return(Redirect(returnUrl));
         }
         else
         {
             return(RedirectToAction("Index"));
         }
     }
     return(View(person));
 }
コード例 #2
0
 public IActionResult Edit(Location location)
 {
     if (ModelState.IsValid)
     {
         _context.Update(location);
         _context.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(location));
 }
コード例 #3
0
 public IActionResult Edit(Experience experience)
 {
     if (ModelState.IsValid)
     {
         _context.Update(experience);
         _context.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(checkLogin(View(experience)));
 }