Esempio n. 1
0
        private UserTable RetrieveUser(string userName)
        {
            RetrieveUserClass retrieveUser = new RetrieveUserClass(DatabaseOptionConfigRetriever.DatabaseOptionAppSetting);
            var user = retrieveUser.GetEntityMatchingFunc(u => u.UserName == userName);

            if (user == null)
            {
                throw new Exception();
            }
            return(user);
        }
Esempio n. 2
0
 public List <MessageTransactionInfoContract> GetMessageTransactionsMatchingUsernameAndReceiverEmail(string username, string recieverEmail)
 {
     try
     {
         RetrieveUserClass retrieveUser = new RetrieveUserClass(DbContextConstant.MsSqlDbContext);
         long senderId = retrieveUser.GetEntityMatchingFunc(u => u.UserName == username).Id;
         RetrieveMessageTransactionClass retrieveMessageTransaction = new RetrieveMessageTransactionClass(DbContextConstant.MsSqlDbContext);
         return(retrieveMessageTransaction.GetAllEntitiesMatchingCondtionsEagerLoadAssociatedEntitiesFunc(t => t.Message, t => t.Message.SenderId == senderId)
                .Select(m => CreateRetrieveMessageContract(username, m.EmailAddress, m.Message.MessageCreated.Value))
                .ToList());
     }
     catch (Exception exception)
     {
         var error = new EntityErrorContract
         {
             Message = exception.Message
         };
         throw new FaultException <EntityErrorContract>(error);
     }
 }