Beispiel #1
0
        public async Task <bool> Create(CustomerEmailHistory CustomerEmailHistory)
        {
            CustomerEmailHistoryDAO CustomerEmailHistoryDAO = new CustomerEmailHistoryDAO();

            CustomerEmailHistoryDAO.Id            = CustomerEmailHistory.Id;
            CustomerEmailHistoryDAO.Title         = CustomerEmailHistory.Title;
            CustomerEmailHistoryDAO.Content       = CustomerEmailHistory.Content;
            CustomerEmailHistoryDAO.Reciepient    = CustomerEmailHistory.Reciepient;
            CustomerEmailHistoryDAO.CustomerId    = CustomerEmailHistory.CustomerId;
            CustomerEmailHistoryDAO.CreatorId     = CustomerEmailHistory.CreatorId;
            CustomerEmailHistoryDAO.EmailStatusId = CustomerEmailHistory.EmailStatusId;
            CustomerEmailHistoryDAO.CreatedAt     = StaticParams.DateTimeNow;
            CustomerEmailHistoryDAO.UpdatedAt     = StaticParams.DateTimeNow;
            DataContext.CustomerEmailHistory.Add(CustomerEmailHistoryDAO);
            await DataContext.SaveChangesAsync();

            CustomerEmailHistory.Id = CustomerEmailHistoryDAO.Id;
            await SaveReference(CustomerEmailHistory);

            return(true);
        }
Beispiel #2
0
        public async Task <bool> BulkMerge(List <CustomerEmailHistory> CustomerEmailHistories)
        {
            List <CustomerEmailHistoryDAO> CustomerEmailHistoryDAOs = new List <CustomerEmailHistoryDAO>();

            foreach (CustomerEmailHistory CustomerEmailHistory in CustomerEmailHistories)
            {
                CustomerEmailHistoryDAO CustomerEmailHistoryDAO = new CustomerEmailHistoryDAO();
                CustomerEmailHistoryDAO.Id            = CustomerEmailHistory.Id;
                CustomerEmailHistoryDAO.Title         = CustomerEmailHistory.Title;
                CustomerEmailHistoryDAO.Content       = CustomerEmailHistory.Content;
                CustomerEmailHistoryDAO.Reciepient    = CustomerEmailHistory.Reciepient;
                CustomerEmailHistoryDAO.CustomerId    = CustomerEmailHistory.CustomerId;
                CustomerEmailHistoryDAO.CreatorId     = CustomerEmailHistory.CreatorId;
                CustomerEmailHistoryDAO.EmailStatusId = CustomerEmailHistory.EmailStatusId;
                CustomerEmailHistoryDAO.CreatedAt     = StaticParams.DateTimeNow;
                CustomerEmailHistoryDAO.UpdatedAt     = StaticParams.DateTimeNow;
                CustomerEmailHistoryDAOs.Add(CustomerEmailHistoryDAO);
            }
            await DataContext.BulkMergeAsync(CustomerEmailHistoryDAOs);

            return(true);
        }
Beispiel #3
0
        public async Task <bool> Update(CustomerEmailHistory CustomerEmailHistory)
        {
            CustomerEmailHistoryDAO CustomerEmailHistoryDAO = DataContext.CustomerEmailHistory.Where(x => x.Id == CustomerEmailHistory.Id).FirstOrDefault();

            if (CustomerEmailHistoryDAO == null)
            {
                return(false);
            }
            CustomerEmailHistoryDAO.Id            = CustomerEmailHistory.Id;
            CustomerEmailHistoryDAO.Title         = CustomerEmailHistory.Title;
            CustomerEmailHistoryDAO.Content       = CustomerEmailHistory.Content;
            CustomerEmailHistoryDAO.Reciepient    = CustomerEmailHistory.Reciepient;
            CustomerEmailHistoryDAO.CustomerId    = CustomerEmailHistory.CustomerId;
            CustomerEmailHistoryDAO.CreatorId     = CustomerEmailHistory.CreatorId;
            CustomerEmailHistoryDAO.EmailStatusId = CustomerEmailHistory.EmailStatusId;
            CustomerEmailHistoryDAO.UpdatedAt     = StaticParams.DateTimeNow;
            await DataContext.SaveChangesAsync();

            await SaveReference(CustomerEmailHistory);

            return(true);
        }