Exemple #1
0
        public async Task <int> UpdateUserAsync(User user)
        {
            User u = await GetUserByEmailAsync(user.Email);

            if (u != null)
            {
                if (u.Id != user.Id)
                {
                    return(-1);                                // If email alreay assigned to other user
                }
                Context.Entry(u).State = EntityState.Detached; // To be able to attach user
            }

            Context.Entry(user).State = EntityState.Modified;
            return(await Context.SaveChangesAsync());
        }
Exemple #2
0
        public async Task <int> UpdateRunAsync(Run run)
        {
            Context.Entry(run).State = EntityState.Modified;

            return(await Context.SaveChangesAsync());
        }