public void RegionService_Delete_ShouldRemoveRegionFromTheSession() { var region = new Region(); Session.Transact(session => session.Save(region)); _regionService.Delete(region); Session.QueryOver <Region>().RowCount().Should().Be(0); }
private async Task Delete(long regionsId) { var deleteModal = ModalService.Show <DeleteModal>("Confirm delete operation"); var deleteResult = await deleteModal.Result; if (!deleteResult.Cancelled) { await RegionService.Delete(regionsId.ToString()); Regions.Remove(Regions.First(regions => regions.Id.Equals(regionsId))); } }
public void TestDelete() { this.TestAdd(); ConfigurationHelper.Ensure(); var service = new RegionService(); var countBefore = service.GetAll().Count(); var maxId = service.GetAll().Max(i => i.Id); service.Delete(maxId); var countAfter = service.GetAll().Count(); Assert.Equal(countBefore, countAfter + 1); }
public ActionResult DeleteRegion(int id) { regionService.Delete(id); ModelState.Clear(); return(Redirect(Request.UrlReferrer.ToString())); }