public ActionResult DeleteConfirmed(Guid id) { BackLink backLink = db.BackLinks.Find(id); backLink.IsDeleted = true; backLink.DeletionDate = DateTime.Now; db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(BackLink backLink) { if (ModelState.IsValid) { backLink.IsDeleted = false; backLink.LastModifiedDate = DateTime.Now; db.Entry(backLink).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(backLink)); }
public ActionResult Delete(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BackLink backLink = db.BackLinks.Find(id); if (backLink == null) { return(HttpNotFound()); } return(View(backLink)); }
public ActionResult Create(BackLink backLink) { if (ModelState.IsValid) { backLink.IsDeleted = false; backLink.CreationDate = DateTime.Now; backLink.Id = Guid.NewGuid(); db.BackLinks.Add(backLink); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(backLink)); }
public ActionResult Index(Guid id) { var backLinkDetails = db.BackLinkDetails.Include(b => b.BackLink) .Where(b => b.BackLinkId == id && b.IsDeleted == false).OrderByDescending(b => b.CreationDate) .Include(b => b.Product); BackLink backlink = db.BackLinks.Find(id); if (backlink != null) { ViewBag.Title = "فهرست ماه های " + backlink.FullName; } return(View(backLinkDetails.ToList())); }
public void WhenBackLinkInvoked_ThenViewModelLinkTextShouldBeSetToBackAsDefault() { var values = new Dictionary <string, string>() { }; var component = new BackLink(); component.ViewComponentContext = ViewComponentTestHelper.GetViewComponentContext(); ViewViewComponentResult result = component.Invoke(values) as ViewViewComponentResult; LinkModel resultModel = (LinkModel)result.ViewData.Model; //Assert "Back".Should().Be(ViewComponentTestHelper.GetPropertyValue(resultModel, "LinkText")); }
public void WhenBackLinkInvoked_ThenViewModelIsUpdated(string key, string value) { var values = new Dictionary <string, string>() { { key, value } }; var component = new BackLink(); component.ViewComponentContext = ViewComponentTestHelper.GetViewComponentContext(); ViewViewComponentResult result = component.Invoke(values) as ViewViewComponentResult; LinkModel resultModel = (LinkModel)result.ViewData.Model; //Assert value.Should().Be(ViewComponentTestHelper.GetPropertyValue(resultModel, key)); }