public IHttpActionResult DeleteClerck(USERS_DTO user) { try { UserCRUD.Delete(user); return(Ok()); } catch (Exception ex) { return(InternalServerError(ex)); } }
public void WhenDeletingAUser_UsersTableCountIsDecrementedByOne() { int beforeCount = 0; int afterCount = 0; using (var db = new PosContext()) { db.Users.Add(TestUser); db.SaveChanges(); userCRUD.selectedUser = TestUser; beforeCount = db.Users.Count(); userCRUD.Delete(TestUser.UserID); afterCount = db.Users.Count(); } Assert.AreEqual(beforeCount - 1, afterCount); }
public async void OnDeleteClicked(object sender, EventArgs args) { try { bool accepted = await DisplayAlert("Confirm", "Are you Sure ?", "Yes", "No"); if (accepted) { userCRUD.Delete(selusers); } await DisplayAlert("Sucess", "Data is Deleted Successfully", "OK"); await Navigation.PushAsync(new Userlist()); } catch (Exception ex) { string error = ex.ToString(); await DisplayAlert("Sorry...", "Something went wrong. Try after sometime.", "OK"); } }
public bool UserDelete(int id) { UserCRUD user = new UserCRUD(); return(user.Delete(id)); }