public ActionResult DeleteConfirmed(int id) { Label label = LabelRepository.GetSingle(id); try { LabelRepository.Delete(label); LabelRepository.Save(); if (IsSuperAdmin) { return(RedirectToAction("Index", new { storeId = label.StoreId })); } else { return(RedirectToAction("Index")); } } catch (Exception ex) { Logger.Error(ex, "Unable to delete it:" + ex.StackTrace, label); ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator."); } return(View(label)); }
public async Task DeleteLabel() { int deleteResult = await _labelRepository.Delete(1, 1); Assert.IsNotNull(deleteResult); Assert.AreEqual(1, deleteResult); }
public async Task Delete_ValidParameters_SetsCorrectResourceAndMethod() { var sut = new LabelRepository(_requestFactory); await sut.Delete(0, "name"); _requestFactory.Received().Create("projects/{projectId}/labels", Method.Delete); }
private bool LabelDelete(AppDbContext dbc, SVP.CIL.Domain.Label target) { var repo = new LabelRepository(dbc); var label = repo.Load(target.Id); repo.Delete(label); dbc.SaveChanges(); return(true); }
public async Task Delete_ValidParameters_AddsProjectIdUrlSegment() { const uint expected = 0; var sut = new LabelRepository(_requestFactory); await sut.Delete(expected, "name"); _request.Received().AddUrlSegment("projectId", expected); }
public async Task Delete_ValidParameters_AddsNameParameter() { const string expected = "name"; var sut = new LabelRepository(_requestFactory); await sut.Delete(0, expected); _request.Received().AddParameter("name", expected); }
/// <summary> /// delete tag item /// </summary> /// <param name="id">identifier of tag</param> /// <returns>returns the result to action</returns> public ActionResult Delete(int id) { LabelRepository objtag = new LabelRepository(SessionCustom); objtag.Entity.LabelId = id; objtag.Delete(); this.InsertAudit("Delete", this.Module.Name + " -> " + id); return(this.RedirectToAction("Index", "Label")); }
public async Task <ActionResult <string> > DeleteLabel(string labelid) { return(await lr.Delete(labelid, HttpContext.Items["UserID"].ToString())); }
public async Task Delete_NameIsNull_ThrowsArgumentNullException() { var sut = new LabelRepository(_requestFactory); await Assert.ThrowsAsync <ArgumentNullException>(() => sut.Delete(0, null)); }