示例#1
0
        internal static void EnsureAuthorExists(String authorEmail, out AuthorLINQ authorLinq, String message, MinimaServiceLINQDataContext db)
        {
            Func <AuthorLINQ, Boolean> authorExists = x => x.AuthorEmail == authorEmail;

            authorLinq = db.Authors.SingleOrDefault(authorExists);
            if (authorLinq == null)
            {
                throw new ArgumentException(message);
            }
        }
示例#2
0
 public String CreateAuthor(String authorEmail, String authorName)
 {
     using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString))
     {
         String authorGuid = String.Empty;
         if (!db.Authors.Any(p => p.AuthorEmail == authorEmail))
         {
             AuthorLINQ authorLinq = new AuthorLINQ();
             authorLinq.AuthorEmail      = authorEmail;
             authorLinq.AuthorName       = authorName;
             authorLinq.AuthorGuid       = Themelia.GuidCreator.GetNewGuid();
             authorLinq.AuthorCreateDate = DateTime.Now;
             //+
             db.Authors.InsertOnSubmit(authorLinq);
             db.SubmitChanges();
             //+
             authorGuid = authorLinq.AuthorGuid;
         }
         //+
         return(authorGuid);
     }
 }
示例#3
0
 //- ~EnsureAuthorExists -//
 internal static void EnsureAuthorExists(String authorEmail, out AuthorLINQ authorLinq, MinimaServiceLINQDataContext db)
 {
     EnsureAuthorExists(authorEmail, out authorLinq, Message.InvalidEmail, db);
 }