public ActionResult CreateMediaImageComment(int mediaImageId) { var comment = new MediaImageComment() { MediaImageId = mediaImageId }; return(PartialView("_CreateOrEditMediaImageComment", comment)); }
public ActionResult EditMediaImageComment(MediaImageComment mediaImagecomment) { if (ModelState.IsValid) { _commentRepo.InsertOrUpdateMediaImageComments(mediaImagecomment); _commentRepo.Save(); return(new HttpStatusCodeResult(HttpStatusCode.OK)); } return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); }
public void InsertOrUpdate(MediaImageComment mediaImagecomment) { if (mediaImagecomment.Id == default(int)) { // New entity context.MediaImageComments.Add(mediaImagecomment); } else { // Existing entity context.Entry(mediaImagecomment).State = EntityState.Modified; } }