public void IsDeleteable() { object id = 6546;//test object to be deleted id HttpResponseMessage response = repository.Delete(id); string jsonContents = response.Content.ReadAsStringAsync().Result; Guest deletedGuest = JsonConvert.DeserializeObject <Guest>(jsonContents); Assert.IsTrue(response.StatusCode == System.Net.HttpStatusCode.Created, "Guest deletion test has failed."); Assert.Equals(deletedGuest.PersonalCode, id); }
private void btnSil_Click(object sender, EventArgs e) { if (MessageBox.Show("Silmek İstiyor musunuz?", "SİLİNSİN Mİ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (Gr.Delete(GId)) { MessageBox.Show("Ziyaretçi bilgileri silindi.", "Silme gerçekleşti."); GridDuzenle(Gr.GetGuestsInRoom(OdaId)); Temizle(); } } }
public async Task <bool> DeleteMemberAsync(Guest Guest) { var _Guest = Guests.Where((Guest arg) => arg.PersonalCode == Guest.PersonalCode).FirstOrDefault(); List <Visit> visitsToDelete = visitRepository.GetAll().Where((Visit visit) => visit.GuestId == _Guest.PersonalCode).ToList(); foreach (var visit in visitsToDelete) { visitRepository.Delete(visit.ID); } Guests.Remove(_Guest); guestRepository.Delete(_Guest.PersonalCode); return(await Task.FromResult(true)); }