Beispiel #1
0
        public static AuthorEntity DetailAuthor(string Id)
        {
            AuthorEntity authorEntity = new Entity.AuthorEntity();

            using (LMSEntities dbe = new LMSEntities())
            {
                Author author = dbe.Authors.Where(o => o.Id.Equals(Id)).Single();
                authorEntity.Id            = author.Id;
                authorEntity.FirstName     = author.FirstName;
                authorEntity.LastName      = author.LastName;
                authorEntity.Phone         = author.Phone;
                authorEntity.Email         = author.Email;
                authorEntity.Qualification = author.Qualification;
            }
            return(authorEntity);
        }
Beispiel #2
0
        public static List <AuthorEntity> GetAuthors()
        {
            List <AuthorEntity> authors = new List <Entity.AuthorEntity>();

            using (LMSEntities dbe = new LMSEntities())
            {
                AuthorEntity authorEntity;
                var          authorList = dbe.Authors.ToList();
                foreach (Author author in authorList)
                {
                    authorEntity               = new Entity.AuthorEntity();
                    authorEntity.Id            = author.Id;
                    authorEntity.FirstName     = author.FirstName;
                    authorEntity.LastName      = author.LastName;
                    authorEntity.Phone         = author.Phone;
                    authorEntity.Email         = author.Email;
                    authorEntity.Qualification = author.Qualification;
                    authors.Add(authorEntity);
                }
            }
            return(authors);
        }