public void Delete(string UserId) { if (ModelState.IsValid) { RegistrationRepository.Delete(UserId); } }
public void Call() { var registrations = _registrationRepository.GetAll(); PrintHelpers.PrintRegistrations(registrations); Console.WriteLine("Type registration id or exit"); var isRead = ReadHelpers.TryReadNumber(out var registrationId); if (!isRead) { return; } var result = _registrationRepository.Delete(registrationId); if (result == ResponseResultType.NotFound) { Console.WriteLine("Registration not found"); } if (result == ResponseResultType.Success) { Console.WriteLine("Successfully deleted registration"); } Console.ReadLine(); Console.Clear(); }
public void CanDelete() { SPWeb web = RecorderManager.CreateMockedObject <SPWeb>(); serviceLocator.Register <IListItemRepository>(typeof(MockListItemRepository)); RegistrationRepository repository = new RegistrationRepository(); repository.Delete(1, web); Assert.IsTrue(MockListItemRepository.CalledUpdateOrDelete); MockManager.Verify(); }
public IHttpActionResult Delete(Guid id) { try { var notification = _registrationRepository.GetById(id); _registrationRepository.Delete(id); } catch (Exception e) { return(InternalServerError(e)); } return(Content(HttpStatusCode.NoContent, "Registratie is met succes verwijderd.")); }
// // GET: /Employee1/Delete/5 // [UserAuthorized] public ActionResult Delete(int id) { var objRegistrationRepository = new RegistrationRepository(); int result = 0; result = objRegistrationRepository.Delete(RegistrationFlags.DeleteByID.GetHashCode(), new RegistrationViewModel() { RegistrationId = id }); if (result == ResultFlags.Success.GetHashCode()) { this.Flash("success", "Account deleted successfully "); return(RedirectToAction("Index")); } else if (result == ResultFlags.Failure.GetHashCode()) { this.Flash("error", "Failed to delete your account"); return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
protected void UsersList_RowCommand(object sender, GridViewCommandEventArgs e) { rm = new RegistrationModel(); int index = Convert.ToInt32(e.CommandArgument); rm.Id = Convert.ToInt32(UsersListGrid.Rows[index].Cells[3].Text); if (e.CommandName == "DeleteRow") { //re.Id = Convert.ToInt32(RealEstateList.Rows[index].Cells[3].Text); bool res = rr.Delete(rm); if (res) { string message = "Deleting info was successfully"; string script = "window.onload = function(){ alert('"; script += message; script += "')};"; ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true); //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Record Inserted Successfully')", true); } else { string message = "Deleting info was not successfully"; string script = "window.onload = function(){ alert('"; script += message; script += "')};"; ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true); } GetData(); } if (e.CommandName == "EditRow") { btnSave.Visible = false; btnUpdate.Visible = true; addNew.Visible = true; showList.Visible = false; UserId.Text = UsersListGrid.Rows[index].Cells[3].Text.ToString(); FirstName.Text = UsersListGrid.Rows[index].Cells[4].Text.ToString(); LastName.Text = UsersListGrid.Rows[index].Cells[5].Text.ToString(); BirthDate.Text = UsersListGrid.Rows[index].Cells[6].Text.ToString(); //SexDropDown.SelectedItem.Text = SexDropDown.Items.FindByText(dtRow[4].ToString()).ToString(); string a = UsersListGrid.Rows[index].Cells[7].Text.ToString(); SexDropDown.SelectedIndex = SexDropDown.Items.IndexOf(SexDropDown.Items.FindByValue(a)); string b = UsersListGrid.Rows[index].Cells[8].Text.ToString(); DiabetesTypeDropDown.SelectedIndex = DiabetesTypeDropDown.Items.IndexOf(DiabetesTypeDropDown.Items.FindByValue(b)); // Religion.Text = UsersListGrid.Rows[index].Cells[9].Text.ToString(); string d = UsersListGrid.Rows[index].Cells[9].Text.ToString(); ReligionDropDown.SelectedIndex = ReligionDropDown.Items.IndexOf(ReligionDropDown.Items.FindByValue(d)); string c = UsersListGrid.Rows[index].Cells[10].Text.ToString(); CookingLevelDropDown.SelectedIndex = CookingLevelDropDown.Items.IndexOf(CookingLevelDropDown.Items.FindByValue(c)); // CookingLevelDropDown.SelectedItem.Text = CookingLevelDropDown.Items.FindByText(dtRow[7].ToString()).ToString(); // UserPreferences.Text = UsersListGrid.Rows[index].Cells[11].Text.ToString(); string r = UsersListGrid.Rows[index].Cells[11].Text.ToString(); VegtableDropDownList.SelectedIndex = VegtableDropDownList.Items.IndexOf(VegtableDropDownList.Items.FindByValue(r)); string t = UsersListGrid.Rows[index].Cells[12].Text.ToString(); MeatDropDownList.SelectedIndex = MeatDropDownList.Items.IndexOf(MeatDropDownList.Items.FindByValue(t)); MaximumCalery.Text = UsersListGrid.Rows[index].Cells[13].Text.ToString(); string h = UsersListGrid.Rows[index].Cells[14].Text.ToString(); string[] words = h.Split(','); for (int i = 0; i <= words.Length - 1; i++) { if (CheckBox1.Text == words[i].ToString()) { CheckBox1.Checked = true; } if (CheckBox2.Text == words[i].ToString()) { CheckBox2.Checked = true; } if (CheckBox3.Text == words[i].ToString()) { CheckBox3.Checked = true; } if (CheckBox4.Text == words[i].ToString()) { CheckBox4.Checked = true; } if (CheckBox5.Text == words[i].ToString()) { CheckBox5.Checked = true; } if (CheckBox6.Text == words[i].ToString()) { CheckBox6.Checked = true; } if (CheckBox7.Text == words[i].ToString()) { CheckBox7.Checked = true; } if (CheckBox8.Text == words[i].ToString()) { CheckBox8.Checked = true; } if (CheckBox9.Text == words[i].ToString()) { CheckBox9.Checked = true; } } // Allergy.Text = UsersListGrid.Rows[index].Cells[13].Text.ToString(); // FoodHistory.Text = UsersListGrid.Rows[index].Cells[14].Text.ToString(); // SportHistory.Text = UsersListGrid.Rows[index].Cells[15].Text.ToString(); //UserName.Text = UsersListGrid.Rows[index].Cells[17].Text.ToString(); //Password.Text = UsersListGrid.Rows[index].Cells[18].Text.ToString(); //ConfirmPassword.Text = UsersListGrid.Rows[index].Cells[18].Text.ToString(); } }