コード例 #1
0
        public ActionResult CreateNewsSourceComment(int newssourceid)
        {
            var comment = new NewsSourceComment()
            {
                NewsSourceId = newssourceid
            };

            return(PartialView("_CreateOrEditNewsSourceComment", comment));
        }
コード例 #2
0
 public ActionResult EditNewsSourceComment(NewsSourceComment NewsSourcecomment)
 {
     if (ModelState.IsValid)
     {
         _commentRepo.InsertOrUpdateNewsSourceComments(NewsSourcecomment);
         _commentRepo.Save();
         return(new HttpStatusCodeResult(HttpStatusCode.OK));
     }
     return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
 }
コード例 #3
0
 public void InsertOrUpdateNewsSourceComments(NewsSourceComment newssourcecomment)
 {
     if (newssourcecomment.Id == default(int))
     {
         // New entity
         context.NewsSourceComments.Add(newssourcecomment);
     }
     else
     {
         // Existing entity
         context.Entry(newssourcecomment).State = EntityState.Modified;
     }
 }