public async void Test_ProfileRepository_DeleteAsync(ProfileModel profile) { await _connection.OpenAsync(); try { using (var ctx = new AccountContext(_options)) { await ctx.Database.EnsureCreatedAsync(); await ctx.Profiles.AddAsync(profile); await ctx.SaveChangesAsync(); } using (var ctx = new AccountContext(_options)) { var profiles = new ProfileRepository(ctx); await profiles.Delete(1); await ctx.SaveChangesAsync(); Assert.Empty(await ctx.Profiles.ToListAsync()); } } finally { await _connection.CloseAsync(); } }
public ActionResult Delete(long id) { var profileRepo = new ProfileRepository(); profileRepo.Delete(id); return(RedirectToAction("Index")); }
public bool Delete(int userId) { if (userId < 1) { throw new ArgumentException($"Provide valid {nameof(userId)}"); } return(profileRepository.Delete(userId)); }
private void BtnDelete_Click(object sender, EventArgs e) { if (lstAppUsers.SelectedIndex > -1) { profileRepository.Delete(profile); appUserRepository.Delete(appUser); LoadListBox(); ClearTextBoxes(); } }
public void DeleteByIdSuccess() { var profile = new Profile { Name = "Maria", Email = "*****@*****.**", Password = "******", Role = role, IsActive = true }; profile = profileRepo.EditOrCreate(profile); profiles.Add(profile); profileRepo.Delete(profile.Id); var profileInDatabase = profileRepo.GetById(profile.Id); Assert.IsFalse(profileInDatabase.IsActive); }
public bool Delete( ) { var conf = new Configuration(); conf.WorkingDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Test"); var fio = MokProfile.GetSomeProfile().FIO + ".txt"; IProfileRepository testRepository = new ProfileRepository(conf, new TestJob.Repository.EntityTextFormatter <Profile>()); var res = testRepository.Delete(fio);; Assert.IsTrue(res); return(res); }
// DELETE: api/Profiles/5 public IHttpActionResult Delete(int id) { var repository = new ProfileRepository(); var profile = repository.GetProfileById(id); if (profile == null) { return(NotFound()); } repository.Delete(profile); return(Ok()); }
public void Remove(IProfile profile) { ProfileRepository.Delete(profile.Name, _accountName); Profiles.Remove(profile.Name); RaiseProfileCollectionChanged(); }
public ActionResult Delete(string id) { _profileRepo.Delete(id); return(RedirectToAction("Index")); }
public IHttpActionResult Delete(string id) { _repo.Delete(id); return(Ok("Deleted: " + id)); }
/// <summary> /// Permanently delete the profile records associated with the specified <paramref name="gallery" />. /// </summary> /// <param name="gallery">The gallery.</param> /// <exception cref="ArgumentNullException">Thrown when <paramref name="gallery" /> is null.</exception> public static void DeleteProfileForGallery(Gallery gallery) { if (gallery == null) throw new ArgumentNullException("gallery"); using (var repo = new ProfileRepository()) { foreach (var pDto in repo.Where(p => p.FKGalleryId == gallery.GalleryId)) { repo.Delete(pDto); } repo.Save(); } }
/// <summary> /// Permanently delete the profile records for the specified <paramref name="userName" />. /// The profile cache is cleared. /// </summary> /// <param name="userName">Name of the user.</param> public static void DeleteUserProfile(string userName) { //GetDataProvider().Profile_DeleteProfileForUser(userName); using (var repo = new ProfileRepository()) { foreach (var pDto in repo.Where(p => p.UserName == userName)) { repo.Delete(pDto); } repo.Save(); } HelperFunctions.RemoveCache(CacheItem.Profiles); }