Exemplo n.º 1
0
 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 + "\" />");
 }
Exemplo n.º 2
0
 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 });
 }
Exemplo n.º 3
0
 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 });
 }
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
		private void detach_Editions(Edition entity)
		{
			this.SendPropertyChanging();
			entity.Binding = null;
		}
Exemplo n.º 6
0
		private void attach_Editions(Edition entity)
		{
			this.SendPropertyChanging();
			entity.Binding = this;
		}
Exemplo n.º 7
0
		private void detach_Editions1(Edition entity)
		{
			this.SendPropertyChanging();
			entity.UploadedFile1 = null;
		}
Exemplo n.º 8
0
		private void attach_Editions(Edition entity)
		{
			this.SendPropertyChanging();
			entity.UploadedFile = this;
		}
Exemplo n.º 9
0
 partial void DeleteEdition(Edition instance);
Exemplo n.º 10
0
 partial void UpdateEdition(Edition instance);
Exemplo n.º 11
0
 partial void InsertEdition(Edition instance);
Exemplo n.º 12
0
 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);
 }
Exemplo n.º 13
0
 public void Add(Edition edition)
 {
     _db.Editions.InsertOnSubmit(edition);
 }