public ActionResult Create(Comment comment, int?noteid) { ModelState.Remove("CreatedOn"); ModelState.Remove("ModifiedOn"); ModelState.Remove("ModifiedUsername"); if (ModelState.IsValid) { if (noteid == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Song note = noteManager.Find(x => x.Id == noteid); if (note == null) { return(new HttpNotFoundResult()); } comment.Song = note; comment.Owner = CurrentSession.User; if (commentManager.Insert(comment) > 0) { return(Json(new { result = true }, JsonRequestBehavior.AllowGet)); } } return(Json(new { result = false }, JsonRequestBehavior.AllowGet)); }
public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Song note = songManager.Find(x => x.Id == id); if (note == null) { return(HttpNotFound()); } return(View(note)); }