예제 #1
0
        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();
        }
예제 #2
0
 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
     };
 }
예제 #3
0
 public void RemoveMagazine(MagazineBusinessModel magazine)
 {
     this.uow.Items.Delete(magazine.Id);
 }
예제 #4
0
 public void CreateMagazine(MagazineBusinessModel magazine)
 {
     this.uow.Items.Add(new MagazineMapper().Map(magazine));
     this.uow.Commit();
 }
예제 #5
0
 public void RemoveMagazine(MagazineBusinessModel magazine)
 {
     this.magazineFacade.RemoveMagazine(magazine);
 }
예제 #6
0
 public void CreateMagazine(MagazineBusinessModel magazine)
 {
     this.magazineFacade.CreateMagazine(magazine);
 }
예제 #7
0
 public void UpdateMagazine(MagazineBusinessModel magazine)
 {
     this.magazineFacade.UpdateMagazine(magazine);
 }
예제 #8
0
        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);
        }
예제 #9
0
 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;
     }
 }