public void Delete_Returns_True_If_Deleted_Existing() { Rating r = new Rating(); r.Description = "Test Delete"; int id = manager.Create(r); bool actual = manager.Delete(id); Assert.IsTrue(actual); }
protected void DeleteButton_Click(object sender, EventArgs e) { RatingManager manager = new RatingManager(); int id = Convert.ToInt32(RatingDropDownList.SelectedValue); manager.Delete(id); DoDataBind(); RatingTextBox.Text = string.Empty; manager.Dispose(); }
public ActionResult Delete(int id, Rating rating) { try { // TODO: Add delete logic here RatingManager.Delete(id); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Delete(int id, FormCollection collection) { try { // TODO: Add delete logic here RatingManager.Delete(id); return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.message = ex.Message; return(View()); } }
public ActionResult Delete(Rating rating) { using (manager = new RatingManager()) { manager.Delete(rating.Id); } if (rating == null) { return(HttpNotFound()); } else { return(RedirectToAction("Index")); } }
protected void btnDelete_Click(object sender, EventArgs e) { try { //get the selected degreetype object that i want to use item = items[ddlExisting.SelectedIndex]; //delete it from the database int results = RatingManager.Delete(item.Id); //remove it from degreeTypes items.Remove(item); //rebind Rebind(); Response.Write("Deleted " + results + " rows..."); } catch (Exception ex) { Response.Write(ex.Message); } }
protected void btnDelete_Click(object sender, EventArgs e) { try { // Get the one the user has selected rating = ratings[ddlRatings.SelectedIndex]; // Add to the database RatingManager.Delete(rating.Id); // Remove it from the list ratings.Remove(rating); Rebind(); } catch (Exception ex) { Response.Write("Error: " + ex.Message); } }
public void DeleteTest() { Assert.IsTrue(RatingManager.Delete(5) > 0); }
// DELETE: api/Rating/5 public void Delete(int id) { RatingManager.Delete(id); }
public void DeleteTest() { int results = RatingManager.Delete(4); Assert.IsTrue(results > 0); }