public ActionResult CreateMediaPublishedComment(int mediaPublishedId) { var comment = new MediaPublishedComment() { MediaPublishedId = mediaPublishedId }; return(PartialView("_CreateOrEditMediaPublishedComment", comment)); }
public ActionResult EditMediaPublishedComment(MediaPublishedComment mediaPublishedcomment) { if (ModelState.IsValid) { _commentRepo.InsertOrUpdateMediaPublishedComments(mediaPublishedcomment); _commentRepo.Save(); return(new HttpStatusCodeResult(HttpStatusCode.OK)); } return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); }
public void InsertOrUpdateMediaPublishedComments(MediaPublishedComment mediapublishedcomment) { if (mediapublishedcomment.Id == default(int)) { // New entity context.MediaPublishedComments.Add(mediapublishedcomment); } else { // Existing entity context.Entry(mediapublishedcomment).State = EntityState.Modified; } }