public ActionResult DeleteConfirmed(int id) { EP_METAS eP_METAS = db.EP_META.Find(id); db.EP_META.Remove(eP_METAS); db.SaveChanges(); return(RedirectToAction("Manage", "Account")); }
public ActionResult Edit([Bind(Include = "ID,UserID,publish,publish_SITE,Publish_ID,Publish_PW,Publish_BLOGID,Publish_BLOGKEY")] EP_METAS eP_METAS) { if (ModelState.IsValid) { db.Entry(eP_METAS).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(eP_METAS)); }
// GET: MetaWeblog/Delete/5 public ActionResult Delete(int?id) { EP_METAS eP_METAS = db.EP_META.Find(id); if (id == null | eP_METAS.UserID != User.Identity.GetUserId()) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (eP_METAS == null) { return(HttpNotFound()); } return(View(eP_METAS)); }
public ActionResult Create([Bind(Include = "ID,UserID,publish,publish_SITE,Publish_ID,Publish_PW,Publish_BLOGID,Publish_BLOGKEY")] EP_METAS eP_METAS, string SERVICE) { if (ModelState.IsValid) { if (SERVICE == "Tistory") { try { string[] strarray = eP_METAS.publish_SITE.Split('/'); MetaWeblog api = new MetaWeblog("http://" + strarray[2] + "/api"); Post[] check_login = new Post[1]; check_login = api.getRecentPosts(eP_METAS.Publish_BLOGID, eP_METAS.Publish_ID, eP_METAS.Publish_PW, 1); } catch { ModelState.AddModelError("", "사용자 이름 또는 암호가 잘못되었습니다."); return(View()); } } if (SERVICE == "Naver") { try { string[] strarray = eP_METAS.publish_SITE.Split('/'); MetaWeblog api = new MetaWeblog("https://api.blog.naver.com/xmlrpc"); Post[] check_login = new Post[1]; check_login = api.getRecentPosts(eP_METAS.Publish_BLOGID, eP_METAS.Publish_ID, eP_METAS.Publish_BLOGKEY, 1); } catch { ModelState.AddModelError("", "사용자 이름 또는 암호가 잘못되었습니다."); return(View()); } } if (SERVICE == "WordPress") { try { string[] strarray = eP_METAS.publish_SITE.Split('/'); MetaWeblog api = new MetaWeblog(eP_METAS.publish_SITE + "/xmlrpc.php"); Post[] check_login = new Post[1]; check_login = api.getRecentPosts("", eP_METAS.Publish_ID, eP_METAS.Publish_PW, 1); } catch { ModelState.AddModelError("", "사용자 이름 또는 암호가 잘못되었습니다."); //return View(); return(RedirectToAction("Create", "BlogAPI", new { SERVICE = "WordPress" })); } } //if (SERVICE == "Blogger") //{ // try // { // string[] strarray = eP_METAS.publish_SITE.Split('/'); // MetaWeblog api = new MetaWeblog("http://www.blogger.com/feeds/" + eP_METAS.ID +"/posts/default"); // Post[] check_login = new Post[1]; // check_login = api.getRecentPosts("", eP_METAS.Publish_ID, eP_METAS.Publish_PW, 1); // } // catch // { // ModelState.AddModelError("", "사용자 이름 또는 암호가 잘못되었습니다."); // return View(); // } //} eP_METAS.publish = SERVICE; eP_METAS.UserID = User.Identity.GetUserId(); //eP_METAS.publish = ViewData["Metaservice"].ToString; db.EP_META.Add(eP_METAS); db.SaveChanges(); return(RedirectToAction("Manage", "Account")); } return(View(eP_METAS)); }