Beispiel #1
0
        public JsonResult DeleteQuery(int id)
        {
            var query = db.Queries.Find(id);

            db.Queries.Remove(query);
            db.SaveChanges();
            return(Json(new { }));
        }
        public JsonResult QueryBuilderSave(Query query)
        {
            var owner = db.UserProfiles.Where(u => u.UserName == User.Identity.Name).FirstOrDefault();

            if (owner != null)
            {
                query.Owner = owner;
            }
            List <UserProfile> userProfiles = new List <UserProfile>();

            foreach (var up in query.UserProfiles)
            {
                userProfiles.Add(db.UserProfiles.Find(up.UserId));
            }
            query.UserProfiles = userProfiles;

            db.Queries.Add(query);
            db.SaveChanges();
            return(Json(new { QueryId = query.QueryId }));
        }
 public void Save()
 {
     QueryBuilderContext.SaveChanges();
 }