public ActionResult Create(BlogPost blogpost) { if (ModelState.IsValid) { _repository.CreateBlogPost(blogpost); return RedirectToAction("Index"); } return View(blogpost); }
// PUT /api/values/5 public HttpResponseMessage Put(BlogPost existingPost) { _repository.UpdateBlogPost(existingPost); return new HttpResponseMessage(System.Net.HttpStatusCode.Created); }
// POST /api/values public HttpResponseMessage Post(BlogPost newPost) { _repository.CreateBlogPost(newPost); return new HttpResponseMessage(System.Net.HttpStatusCode.Created); }