public ActionResult DeleteConfirmed(int id) { MusicPost musicPost = db.MusicPosts.Find(id); db.MusicPosts.Remove(musicPost); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,Desc,PublishDate")] MusicPost musicPost) { if (ModelState.IsValid) { db.Entry(musicPost).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(musicPost)); }
public ActionResult Create([Bind(Include = "ID,Desc,PublishDate")] MusicPost musicPost) { if (ModelState.IsValid) { db.MusicPosts.Add(musicPost); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(musicPost)); }
// GET: MusicPosts/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MusicPost musicPost = db.MusicPosts.Find(id); if (musicPost == null) { return(HttpNotFound()); } return(View(musicPost)); }
public object Deserialize(JsonValue json, JsonMapper mapper) { MusicPost post = null; if ( json != null && !json.IsNull ) { post = new MusicPost(); post.ID = json.ContainsName("id" ) ? json.GetValue<string>("id" ) : String.Empty; post.Source = json.ContainsName("source" ) ? json.GetValue<string>("source") : String.Empty; post.CreatedTime = json.ContainsName("created_time") ? JsonUtils.ToDateTime(json.GetValue<string>("created_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; post.UpdatedTime = json.ContainsName("updated_time") ? JsonUtils.ToDateTime(json.GetValue<string>("updated_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; post.From = mapper.Deserialize<Reference>(json.GetValue("from")); } return post; }
public object Deserialize(JsonValue json, JsonMapper mapper) { MusicPost post = null; if (json != null && !json.IsNull) { post = new MusicPost(); post.ID = json.ContainsName("id") ? json.GetValue <string>("id") : String.Empty; post.Source = json.ContainsName("source") ? json.GetValue <string>("source") : String.Empty; post.CreatedTime = json.ContainsName("created_time") ? JsonUtils.ToDateTime(json.GetValue <string>("created_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; post.UpdatedTime = json.ContainsName("updated_time") ? JsonUtils.ToDateTime(json.GetValue <string>("updated_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; post.From = mapper.Deserialize <Reference>(json.GetValue("from")); } return(post); }