public string GetVoucherNoticiationHtml(MerchantVoucher voucher, int count) { var htmlVoucher = new StringBuilder(); var voucherImageUrl = _imageUrl + voucher.Image; htmlVoucher.Append( $" <table width=\"600\" style=\"margin-bottom: 1em;\"> <tr style=\"display: inline-block; border-bottom: 1px solid grey; width:600px; padding-bottom: 10px;\"> <td style=\"display:inline-block;\"> <img src=\"{voucherImageUrl}\" style=\"width: 300px; height: 150px;\"> </td> <td style=\"display: inline-block; vertical-align: top; margin:5px;\"> <div style=\"font-weight: bold\">{voucher.Name}</div> <div style=\"font-weight: bold\">€ {voucher.Price}</div> <div>Aantal: <span style=\"font-weight: bold\"> {count}</span> </div> </td> </tr> </table>"); return(htmlVoucher.ToString()); }
public async Task CreateMerchantVoucher(MerchantVoucher voucher, DefaultImages image, ApplicationUser user) { voucher.Id = Guid.NewGuid(); voucher.Merchant = user; voucher.Image = $"default-images/{GetImageNameFromEnum(image)}"; _context.Add(voucher); await _context.SaveChangesAsync(); }
public async Task UpdateMerchantVoucher(MerchantVoucher voucher, DefaultImages image) { try { voucher.Image = $"default-images/{GetImageNameFromEnum(image)}"; _context.Update(voucher); await _context.SaveChangesAsync(); } catch (Exception e) { Log.Error($"Error updateing merchant voucher with id: {voucher.Id}, {e}"); } }
public async Task CreateMerchantVoucher(MerchantVoucher voucher, IFormFile image, ApplicationUser user) { voucher.Id = Guid.NewGuid(); voucher.Merchant = user; // Upload file if (image != null) { voucher.Image = await UploadFile(image); } _context.Add(voucher); await _context.SaveChangesAsync(); }
public async Task UpdateMerchantVoucher(MerchantVoucher voucher, IFormFile image) { try { if (image != null) { _azureStorageService.DeleteBlobData(voucher.Image); voucher.Image = await UploadFile(image); } _context.Update(voucher); await _context.SaveChangesAsync(); } catch (Exception e) { Log.Error($"Error updateing merchant voucher with id: {voucher.Id}, {e}"); } }