public EmailQueueEntity Create(EmailQueueEntity emailqueueEntity) { var query = @"INSERT INTO ""EmailQueue""(""Subject"",""FromAddress"",""FromName"",""ToAddress"",""CcAddress"",""BccAddress"",""CreatedDate"",""SendDate"",""ResendDate"",""Body"") VALUES(@Subject,@FromAddress,@FromName,@ToAddress,@CcAddress,@BccAddress,@CreatedDate,@SendDate,@ResendDate,@Body) RETURNING ""ID"";"; int id = DbConnection.Query <int>(query, emailqueueEntity).Single(); emailqueueEntity.ID = id; return(emailqueueEntity); }
public ResultEntity <EmailQueueEntity> Create(EmailQueueEntity emailqueueEntity) { var validationResult = new ResultEntity <EmailQueueEntity>(); using (var emailqueueDA = new EmailQueueDA()) { validationResult.Value = emailqueueDA.Create(emailqueueEntity); } return(validationResult); }
public int Update(EmailQueueEntity emailqueueEntity) { int affectedRows = 0; if (IsHaveId <EmailQueueEntity>(emailqueueEntity) == false) { var query = @"UPDATE ""EmailQueue"" SET ""Subject""=@Subject,""FromAddress""=@FromAddress,""FromName""=@FromName,""ToAddress""=@ToAddress,""CcAddress""=@CcAddress,""BccAddress""=@BccAddress,""CreatedDate""=@CreatedDate,""SendDate""=@SendDate,""ResendDate""=@ResendDate,""Body""=@Body WHERE ""ID""=@ID"; affectedRows = DbConnection.Execute(query, emailqueueEntity); } return(affectedRows); }
public ResultEntity <EmailQueueEntity> Update(EmailQueueEntity emailqueueEntity) { var validationResult = new ResultEntity <EmailQueueEntity>(); using (var emailqueueDA = new EmailQueueDA()) { var resultUpdate = emailqueueDA.Update(emailqueueEntity); if (resultUpdate <= 0) { validationResult.Warning.Add("Failed Updating EmailQueue!"); return(validationResult); } validationResult.Value = emailqueueEntity; } return(validationResult); }