public static HtmlString CoverImage(this HtmlHelper helper, Edition edition) { if (edition.SmallCoverId == null) return null; var legend = helper.Encode(String.Format(SitePhrases.LabelCoverImage, edition.Book.Title)); var urlHelper = new UrlHelper(helper.ViewContext.RequestContext); var source = urlHelper.Action("display", "upload", new { category = edition.UploadedFile.Category, fileName = edition.UploadedFile.FileName }); return new HtmlString("<img src=\"" + source + "\" class=\"cover\" alt=\"" + legend + "\" title=\"" + legend + "\" />"); }
public ActionResult EditEdition(Edition vm) { if (!ModelState.IsValid) { ViewBag.SmallCovers = FileList(FileCategories.SmallCover, vm.SmallCoverId); ViewBag.LargeCovers = FileList(FileCategories.LargeCover, vm.LargeCoverId); ViewBag.Bindings = BindingList(vm.BindingId); vm.Book = Repository.GetBook(vm.BookId); return View(vm); } UpdateModel(Repository.GetEdition(vm.Id)); Repository.Save(); return RedirectToAction("updatereleaseyearcache", new { id = vm.BookId }); }
public ActionResult DeleteEdition(Edition vm) { var edition = Repository.GetEdition(vm.Id); if (edition == null) return HttpNotFound(); Repository.Delete(edition); Repository.Save(); return RedirectToAction("updatereleaseyearcache", new { id = edition.BookId }); }
public ActionResult CreateEdition(int id) { var book = Repository.GetBook(id); if (book == null) return HttpNotFound(); var vm = new Edition { Number = !book.Editions.Any() ? 1 : book.Editions.OrderBy(e => e.Number).Last().Number + 1, ReleaseDate = DateTime.Today, IsForSale = true, BookId = id, Book = book }; ViewBag.SmallCovers = FileList(FileCategories.SmallCover, vm.SmallCoverId); ViewBag.LargeCovers = FileList(FileCategories.LargeCover, vm.LargeCoverId); ViewBag.Bindings = BindingList(vm.BindingId); return View(vm); }
private void detach_Editions(Edition entity) { this.SendPropertyChanging(); entity.Binding = null; }
private void attach_Editions(Edition entity) { this.SendPropertyChanging(); entity.Binding = this; }
private void detach_Editions1(Edition entity) { this.SendPropertyChanging(); entity.UploadedFile1 = null; }
private void attach_Editions(Edition entity) { this.SendPropertyChanging(); entity.UploadedFile = this; }
partial void DeleteEdition(Edition instance);
partial void UpdateEdition(Edition instance);
partial void InsertEdition(Edition instance);
public void Delete(Edition edition) { _db.BookListMemberships.DeleteAllOnSubmit(edition.BookListMemberships); _db.OrderLines.DeleteAllOnSubmit(edition.OrderLines.Where(l => l.Order.ClosedAt != null)); _db.Editions.DeleteOnSubmit(edition); }
public void Add(Edition edition) { _db.Editions.InsertOnSubmit(edition); }