Exemple #1
0
        public async Task <bool> UpdateQuiz(Quiz quiz)
        {
            using (var context = new AssessmentToolContext())
            {
                context.Entry(quiz).State = System.Data.Entity.EntityState.Modified;

                return(await context.SaveChangesAsync() > 0);
            }
        }
Exemple #2
0
        public async Task <bool> DeleteRole(string ID)
        {
            using (var context = new AssessmentToolContext())
            {
                var role = context.Roles.Find(ID);

                if (role != null)
                {
                    context.Entry(role).State = System.Data.Entity.EntityState.Deleted;
                }

                return(await context.SaveChangesAsync() > 0);
            }
        }
Exemple #3
0
        //public async Task<bool> NewUser(AssessmentToolUser user)
        //{
        //    using (var context = new AssessmentToolContext())
        //    {
        //        context.Users.Add(user);

        //        return await context.SaveChangesAsync() > 0;
        //    }
        //}

        public async Task <bool> UpdateRole(IdentityRole role)
        {
            using (var context = new AssessmentToolContext())
            {
                var oldRole = context.Roles.Find(role.Id);

                if (oldRole != null)
                {
                    oldRole.Name = role.Name;

                    context.Entry(oldRole).State = System.Data.Entity.EntityState.Modified;
                }

                return(await context.SaveChangesAsync() > 0);
            }
        }