コード例 #1
0
ファイル: AuthorConverter.cs プロジェクト: SapirShira/library
 public static AuthorDTO ConvertAuthorToDTO(Aauthor auther)
 {
     return(new AuthorDTO
     {
         codAauthor = auther.codAauthor,
         firstName = auther.firstName,
         lastName = auther.lastName,
         LiteraryAlias = auther.LiteraryAlias
     });
 }
コード例 #2
0
ファイル: autherBL.cs プロジェクト: SapirShira/library
        public static bool updateAuther(AuthorDTO a)
        {
            using (libraryEntities db = new libraryEntities())
            {
                Aauthor au = db.Aauthors.First(x => x.codAauthor == a.codAauthor);
                au.firstName     = a.firstName;
                au.lastName      = a.lastName;
                au.LiteraryAlias = a.LiteraryAlias;



                try
                {
                    db.SaveChanges();
                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }