public ActionResult Process(string ID, int ISLEM) { IDatabase2 db = DatabaseFactory.GetDbObject(); IQueryGenerator gen = QueryGeneratorFactory.GetDbObject(); gen.TableName = "comment"; if (ISLEM == 1) { gen.AddDataParameter("APPROVED", 1); } else { gen.AddDataParameter("APPROVED", 2); } gen.FilterText = " WHERE ID=:p1"; gen.AddFilterParameter("p1", ID); db.ExecuteQuery(gen.GetUpdateCommand()); List <Comment> cList = ProcessView(); return(View("Index", cList)); }
public ActionResult ProcessArticle(int ARTICLE_ID, int ISLEM) { try { IDatabase2 db = DatabaseFactory.GetDbObject(DbSettings.TransactionMode); IQueryGenerator gen = QueryGeneratorFactory.GetDbObject(); gen.TableName = "article"; gen.AddDataParameter("ACTIVE", ISLEM); gen.FilterText = "where ID=:p1"; gen.AddFilterParameter("p1", ARTICLE_ID); db.ExecuteQuery(gen.GetUpdateCommand()); db.Commit(); return(RedirectToAction("ManageArticle")); } catch { return(RedirectToAction("ManageArticle")); } }
public ActionResult UpdateArticle(int ARTICLE_ID, string TITLE, string CONTENT, int[] CATEGORIES) { try { IDatabase2 db = DatabaseFactory.GetDbObject(DbSettings.TransactionMode); IQueryGenerator gen = QueryGeneratorFactory.GetDbObject(); gen.TableName = "article"; gen.AddDataParameter("TITLE", TITLE); gen.AddDataParameter("TEXT", CONTENT); gen.AddDataParameter("UPDATE_DATE", DateTime.Now); gen.AddDataParameter("AUTHOR", "vyigity"); gen.FilterText = " where ID=:p1"; gen.AddFilterParameter("p1", ARTICLE_ID); db.ExecuteQuery(gen.GetUpdateCommand()); db.ExecuteQuery("delete from article_category where article_id = " + ARTICLE_ID); if (CATEGORIES != null && CATEGORIES.Length > 0) { foreach (int i in CATEGORIES) { IQueryGenerator gen3 = QueryGeneratorFactory.GetDbObject(); gen3.TableName = "article_category"; gen3.AddDataParameter("ARTICLE_ID", ARTICLE_ID); gen3.AddDataParameter("CATEGORY_ID", i); db.ExecuteQuery(gen3.GetInsertCommand()); } } db.Commit(); return(RedirectToAction("ManageArticle")); } catch { return(RedirectToAction("ArticleUpdate")); } }