コード例 #1
0
 public ActionResult Create(PlaygroundImage playgroundimage)
 {
     if (ModelState.IsValid) {
         playgroundimageRepository.InsertOrUpdate(playgroundimage);
         playgroundimageRepository.Save();
         return RedirectToAction("Index");
     } else {
         ViewBag.PossiblePlaygrounds = playgroundRepository.All;
         return View();
     }
 }
コード例 #2
0
 public void InsertOrUpdate(PlaygroundImage playgroundimage)
 {
     if (playgroundimage.PlaygroundImageId == default(int)) {
         // New entity
         context.PlaygroundImages.Add(playgroundimage);
     } else {
         // Existing entity
         context.Entry(playgroundimage).State = EntityState.Modified;
     }
 }