コード例 #1
0
 public ActionResult Create(story story)
 {
     try
     {
         if (ModelState.IsValid)
         {
             story.PictureID = 1;
             if (story.StoryLine.Length > 2000)
             {
                 return(Content("Error saving: Story more than 2000 string long."));
             }
             db.stories.Add(story);
             db.SaveChanges();
             StoryRepository.AddRecord(story);
             return(Content("Story added successfully"));
         }
     }
     catch (Exception ex)
     {
         TempData["Message2"] = "Error adding story";
     }
     GetData(story.MinistryID);
     return(PartialView(story));
 }