public async Task Create(CreateOrEditContactDto input) { input.ContactType = ContactType.GetInTouch; var entity = ObjectMapper.Map <Contact>(input); await contactRepository.InsertAsync(entity); await CurrentUnitOfWork.SaveChangesAsync(); var email = await SettingManager.GetSettingValueAsync(EmailSettingNames.DefaultFromAddress); var content = $"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> " + $"<html xmlns=\"http://www.w3.org/1999/xhtml\"> <head> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />" + $" <title></title> <style> body {{ line - height: 1.4; text-align: left; font-family: \"Roboto\", sans-serif; color: #333333; }}" + $" #bodyTable {{ margin - top: 36px; margin-bottom: 30px; padding-bottom: 80px; }} #emailContainer {{ background: #fff; " + $"border-bottom: 3px solid gainsboro; border: 1px solid #e2e2e2; }} h1 {{ margin - bottom: 0; }} .btn {{ background - color: #63bce5; " + $"color: #fff; display: inline-block; padding: 6px 12px; margin-bottom: 0; font-size: 14px; font-weight: 400; line-height: 1.42857143; " + $"text-align: center; white-space: nowrap; vertical-align: middle; border: 1px solid #fff; border-radius: 4px; text-decoration: none; }}" + $" #emailContainer td {{ padding: 24px 10%; }} a {{ color: #0c82a5; text-decoration: none; }} </style> </head> <body style=\"background: #F5F5F5;\">" + $" <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" height=\"100%\" width=\"100%\" id=\"bodyTable\"> <tr> <td align=\"center\" valign=\"top\">" + $" <table border=\"0\" cellpadding=\"20\" cellspacing=\"0\" width=\"600\" id=\"emailContainer\"> <tr> <td valign=\"top\" " + $"style=\"font-weight: 300; color: #333333; font-size: 16px; line-height: 1.4; text-align: left; font-family: 'Roboto', sans-serif;\"> <p>" + $" Đã có khách hàng đã gửi liên hệ đến hệ thống theo thông tin như dưới đây: </p> <p><b>Thông tin người liên hệ</b></p> " + $"<p> Khách hàng: <span style=\"text-transform:capitalize;\">{input.FullName}</span> <br /> Điện thoại : {input.Phone}" + $" <br /> Email : {input.Email} <br /> Nội dung : {input.Content} </p> <p>Thân mến,<br />Ban quản trị TicketPage. </p> </td> </tr> </table> </td> " + $"</tr> </table> </body> </html>"; emailSender.Send( to: email, subject: "[Sample] Có liên hệ mới", body: content, isBodyHtml: true); }
public async Task CreateOrEdit(CreateOrEditContactDto input) { if (input.Id == null) { await Create(input); } else { await Update(input); } }
protected virtual async Task Create(CreateOrEditContactDto input) { var contact = ObjectMapper.Map <Contact>(input); if (AbpSession.TenantId != null) { contact.TenantId = (int?)AbpSession.TenantId; } await _contactRepository.InsertAsync(contact); }
protected virtual async Task Update(CreateOrEditContactDto input) { var contact = await _contactRepository.FirstOrDefaultAsync((int)input.Id); ObjectMapper.Map(input, contact); }