Ejemplo n.º 1
0
        public void UpdateAuthor(AuthorBusinessModel author)
        {
            var mapper = new AuthorMapper();

            this.uow.Authors.Update(mapper.Map(author));
            this.uow.Commit();
        }
Ejemplo n.º 2
0
        public void CreateAuthor(AuthorBusinessModel author)
        {
            var mapper    = new AuthorMapper();
            var authorNew = mapper.Map(author);

            this.uow.Authors.Add(authorNew);
            this.uow.Commit();
            author.Id = authorNew.Id;// updates the author.Id to Id value from DB
        }
Ejemplo n.º 3
0
        public ActionResult Edit(AuthorBusinessModel author)
        {
            if (ModelState.IsValid)
            {
                this.authorManager.UpdateAuthor(author);
                return(RedirectToAction("Details", new { id = author.Id }));
            }

            return(View(author));
        }
Ejemplo n.º 4
0
        public AuthorMapperTests()
        {
            Fixture fixture = new Fixture {
                RepeatCount = 1
            };

            fixture.Behaviors.Remove(new ThrowingRecursionBehavior());
            fixture.Behaviors.Add(new OmitOnRecursionBehavior());
            fixture.Customizations.Add(new TypeRelay(typeof(Item), typeof(Book)));
            fixture.Customizations.Add(new TypeRelay(typeof(ItemBusinessModel), typeof(BookBusinessModel)));

            this.author      = fixture.Create <Author>();
            this.authorModel = fixture.Create <AuthorBusinessModel>();
            this.mapper      = new AuthorMapper();
        }
Ejemplo n.º 5
0
 public void RemoveAuthor(AuthorBusinessModel author)
 {
     this.authorFacade.RemoveAuthorById(author.Id);
 }
Ejemplo n.º 6
0
 public void CreateAuthor(AuthorBusinessModel author)
 {
     this.authorFacade.CreateAuthor(author);
 }
Ejemplo n.º 7
0
 public void UpdateAuthor(AuthorBusinessModel author)
 {
     this.authorFacade.UpdateAuthor(author);
 }