Exemplo n.º 1
0
 public async Task PostJobErrorResponse(Job jobOpportunity, IUrlHelper urlHelper, string responseUrl)
 {
     if (jobOpportunity == null)
     {
         var payloadObject = new PayloadRequestDto()
         {
             text             = "A new job posting has been created!",
             replace_original = true,
             attachments      = new List <Attachment> {
                 new Attachment {
                     fallback        = "Oops! Looks like this job was removed by its author.",
                     text            = "Oops! Looks like this job was removed by its author.",
                     callback_id     = "0",
                     color           = "danger",
                     attachment_type = "default"
                 }
             }
         };
         await PostNotification(payloadObject, responseUrl).ConfigureAwait(false);
     }
     else
     {
         var payloadObject = new PayloadRequestDto()
         {
             text             = "A new job posting has been created!",
             replace_original = true,
             attachments      = new List <Attachment> {
                 new Attachment {
                     fallback        = "Oops! Looks like something went wrong with this job posting. Log in and check " + urlHelper.AbsoluteUrl("", "elmah.axd") + " for more details.",
                     text            = "Oops! Looks like something went wrong with this job posting. Log in and check " + urlHelper.AbsoluteUrl("", "elmah.axd") + " for more details.",
                     callback_id     = jobOpportunity?.Id.ToString(),
                     color           = "danger",
                     attachment_type = "default"
                 }
             }
         };
         await PostNotification(payloadObject, responseUrl).ConfigureAwait(false);
     }
 }