public void Update(Teacher teacher) { _usersProvider.Update(teacher); if (teacher.Students.Count > 0) { foreach (var student in teacher.Students) { if (!student.Teachers.Any(i => i.Equals(teacher))) { student.Teachers.Add(teacher); _usersProvider.Update(student); } } } }
public void UserIndependent() { IUsersProvider provider = Provider.UsersProvider; provider.Clear().Wait(); Assert.IsFalse(provider.GetAll().Result.Any()); foreach (var v in usernames) { Assert.AreEqual(v, provider.Create(v, new User()).Result); Assert.IsNotNull(provider.Get(v).Result); Assert.AreEqual(v, provider.Update(v, new User()).Result); Assert.AreEqual(v, provider.Delete(v).Result); Assert.IsNull(provider.Get(v).Result); } }
public async Task <string> Update(string id, User data) { return(await provider.Update(id, data)); }