Exemple #1
0
        public void UpdateViews(int id, int views)
        {
            try
            {
                using (var ctx = new DatabaseContext())
                {
                    ctx.Database.ExecuteSqlCommand("UPDATE works SET  views = {1} where id = {0}", id, views);
                    ctx.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }

        }
Exemple #2
0
        public bool UpdatePassword(int id, string password)
        {
            bool updated = false;
            try
            { 
                using (var ctx = new DatabaseContext())
                {

                    ctx.Database.ExecuteSqlCommand("UPDATE users SET  password = {1} where id = {0}", id, password);

                    ctx.SaveChanges();
                    updated = true;
                }   
            }
            catch(Exception ex)
            {
                updated = false;
            }

            return updated;
        }