public void Update(AuthorInfo authorInfo)
        {
            AuthorInfo author = this.GetAuthorListByID(authorInfo.ID);
            author.AuthorName = authorInfo.AuthorName;
            author.AuthorIntroduction = authorInfo.AuthorIntroduction;

            this.DataSource.SaveChanges();
        }
Example #2
0
        public AuthorInfo GetEntity()
        {
            AuthorInfo author = new AuthorInfo();
            author.ID = this.ID;
            author.AuthorName = this.AuthorName;
            author.AuthorIntroduction = this.AuthorIntroduction;

            return author;
        }
Example #3
0
        public static AuthorModel GetViewModel(AuthorInfo author)
        {
            AuthorModel model = new AuthorModel();
            model.ID = author.ID;
            model.AuthorName = author.AuthorName;
            model.AuthorIntroduction = author.AuthorIntroduction;

            if (author.BookAndAuthors.Count > 0)
            {
                model.IsUse = true;
            }

            return model;
        }
 public void Add(AuthorInfo authorInfo)
 {
     this.DataSource.AuthorInfos.Add(authorInfo);
     this.DataSource.SaveChanges();
 }