public void UpdateMagazine(MagazineBusinessModel magazineBusinessModel)
        {
            var mapper = new MagazineMapper();

            var magazineOld = this.uow.Items.GetById(magazineBusinessModel.Id) as Magazine;
           
            magazineOld.Tags.Clear();

            var magazineMapped = mapper.Map(magazineBusinessModel);

            foreach (var tag in magazineBusinessModel.Tags)
            {
                var t = this.uow.Tags.GetById(tag.id);
                magazineOld.Tags.Add(t);
            }

            magazineOld.Name = magazineMapped.Name;
            magazineOld.Issue = magazineMapped.Issue;
            magazineOld.PageCount = magazineMapped.PageCount;
            magazineOld.Publisher = magazineMapped.Publisher;
            magazineOld.Year = magazineMapped.Year;

            this.uow.Items.Update(magazineOld);

            this.uow.Commit();
        }
 public MagazineMapperTest()
 {
     entitytoMap = new Magazine
     {
         Id = 1,
         Consignment = null,
         Inventories = null,
         Issue = 1,
         Name="Magazine",
         PageCount = 1,
         Publisher = "Publisher",
         ReservedItems = null,
         ScannedPage = null,
         Tags = null,
         Year = 2013
     };
     modelToMap = new MagazineBusinessModel()
     {
         Id=1,
         Inventories = null,
         Issue = 1,
         Name="Magazine",
         PageCount = 1,
         Publisher = "Publisher",
         ReservedItems = null,
         ScannedPages = null,
         Tags = null,
         Year = 2013
     };
 }
 public void RemoveMagazine(MagazineBusinessModel magazine)
 {
     this.uow.Items.Delete(magazine.Id);
 }
 public void CreateMagazine(MagazineBusinessModel magazine)
 {
     this.uow.Items.Add(new MagazineMapper().Map(magazine));
     this.uow.Commit();
 }
 public void RemoveMagazine(MagazineBusinessModel magazine)
 {
     this.magazineFacade.RemoveMagazine(magazine);
 }
 public void CreateMagazine(MagazineBusinessModel magazine)
 {
     this.magazineFacade.CreateMagazine(magazine);
 }
 public void UpdateMagazine(MagazineBusinessModel magazine)
 {
     this.magazineFacade.UpdateMagazine(magazine);
 }
        public ActionResult Add(MagazineBusinessModel newMagazine)
        {
            if (ModelState.IsValid)
            {
                this.magazineManager.CreateMagazine(newMagazine);
                this.recommendationManager.RecalculateItemTagScoresAsync(newMagazine.Id);
                return this.RedirectToAction("IndexWithWidgets");
            }

            return this.PartialView("_AddMagazine", newMagazine);
        }
 public virtual ActionResult LoadPartial(string value)
 {
     switch (value)
     {
         case "book":
             var model1 = new BookWithAuthorsShort();
             return this.PartialView("_AddBook", model1);
         case "disk":
             var model2 = new DiskBusinessModel();
             return this.PartialView("_AddDisk", model2);
         case "magazine":
             var model3 = new MagazineBusinessModel();
             return this.PartialView("_AddMagazine", model3);
         default:
             return null;
     }
 }