private web_site_support_text Modify(LeapDataClassesDataContext context, web_site_support_text support_text, string text) { support_text.text_block = text; context.SubmitChanges(); return support_text; }
private web_site_support_text Create(LeapDataClassesDataContext context, string name, string text) { web_site_support_text support_text = new web_site_support_text(); support_text.text_block_name = name; support_text.text_block = text; context.web_site_support_texts.InsertOnSubmit(support_text); context.SubmitChanges(); return support_text; }
public void Log(LeapDataClassesDataContext context, string user_name, string user_ip, string method, string message) { leap_log log = new leap_log(); log.method = method; log.user_name = user_name; log.client_ip = user_ip; log.message = message; log.log_date = DateTime.Now; context.leap_logs.InsertOnSubmit(log); context.SubmitChanges(); }
public void LogPageEdit(LeapDataClassesDataContext context, string text_block_name, string user_name, string user_ip, string old_text, string new_text) { leap_page_edit_log log = new leap_page_edit_log(); log.modified_by = user_name; log.client_ip = user_ip; log.text_block_name = text_block_name; log.old_text = old_text; log.new_text = new_text; log.modified_time = DateTime.Now; context.leap_page_edit_logs.InsertOnSubmit(log); context.SubmitChanges(); }
public JsonResult Delete(int id) { LeapDataClassesDataContext context = new LeapDataClassesDataContext(); IQueryable<data_search> query = context.data_searches.Where(d => d.user_name == User.Identity.Name && d.id == id); if (query.Count() == 0) { return Json(new { error = "No search found" }, JsonRequestBehavior.AllowGet); } data_search dsearch = query.First(); string search_name = dsearch.name; context.data_searches.DeleteOnSubmit(dsearch); context.SubmitChanges(); Log("Delete Search", "Search[" + id + ":" + search_name + "] was deleted."); return Json(new {}, JsonRequestBehavior.AllowGet); }
private leap_event Modify(LeapDataClassesDataContext context, leap_event l_event, DateTime date, string author, string summary, string detail) { l_event.date = date; l_event.author = author; l_event.summary = summary; l_event.detail = detail; context.SubmitChanges(); return Search(context, l_event.id); }
private leap_event Create(LeapDataClassesDataContext context, DateTime date, string author, string summary, string detail) { leap_event l_event = new leap_event(); l_event.date = date; l_event.author = author; l_event.summary = summary; l_event.detail = detail; context.leap_events.InsertOnSubmit(l_event); context.SubmitChanges(); return l_event; }
private data_search Update(LeapDataClassesDataContext context, int id, string search_string) { IQueryable<data_search> query = context.data_searches.Where(d => d.user_name == User.Identity.Name && d.id == id); if (query.Count() == 0) { throw new Exception("search with the id [" + id + "] does not exist!"); } data_search dsearch = query.First(); dsearch.search_string = search_string; dsearch.last_modified_datetime = DateTime.Now; context.SubmitChanges(); return dsearch; }
private data_search Create(LeapDataClassesDataContext context, string name, string search_string) { data_search dsearch = new data_search(); dsearch.name = name; dsearch.user_name = User.Identity.Name; dsearch.created_datetime = DateTime.Now; dsearch.last_modified_datetime = dsearch.created_datetime; dsearch.search_string = search_string; context.data_searches.InsertOnSubmit(dsearch); context.SubmitChanges(); return dsearch; }