private void SetPathAndQuery(Uri uri) { string[] pathAndQuery = uri.PathAndQuery.Split(new string[] { "?" }, StringSplitOptions.RemoveEmptyEntries); Path path = Path.OneWhere(c => c.Value == pathAndQuery[0]); if (path == null) { path = new Path(); path.Value = pathAndQuery[0]; path.Save(); } this.PathId = path.Id; if (pathAndQuery.Length > 1) { string query = pathAndQuery[1]; if (string.IsNullOrEmpty(query)) { this.QueryStringId = QueryString.Empty.Id; } else { QueryString qs = QueryString.OneWhere(c => c.Value == query); if (qs == null) { qs = new QueryString(); qs.Value = pathAndQuery[1]; qs.Save(); } this.QueryStringId = qs.Id; } } }
private static Path CreateFromFilter(IQueryFilter filter, Database database = null) { Database db = database ?? Db.For <Path>(); var dao = new Path(); filter.Parameters.Each(p => { dao.Property(p.ColumnName, p.Value); }); dao.Save(db); return(dao); }
public ActionResult Update(Bam.Net.Analytics.Path dao) { try { dao.Save(); return(Json(new { Success = true, Message = "", Dao = dao.ToJsonSafe() })); } catch (Exception ex) { return(GetErrorResult(ex)); } }
private static Path GetPath(Uri uri) { string[] pathAndQuery = uri.PathAndQuery.Split(new string[] { "?" }, StringSplitOptions.RemoveEmptyEntries); Path path = Path.OneWhere(c => c.Value == pathAndQuery[0]); if (path == null) { path = new Path(); path.Value = pathAndQuery[0]; path.Save(); } return(path); }