Exemplo n.º 1
0
        public override Task WriteResponseBodyAsync(OutputFormatterWriteContext context)
        {
            var attendee = context.Object as Attendee;

            FormattableString card = $@"BEGIN:VCARD
VERSION: 3.0
N:{attendee.LastName};{attendee.FirstName};;;
FN:{attendee.FirstName} {attendee.LastName}
EMAIL;type=INTERNET;type=pref:{attendee.Email}
END:VCARD";

            return(context.HttpContext.Response.WriteAsync(VCardEncoder.Encode(card)));
        }
Exemplo n.º 2
0
        public override Task WriteResponseBodyAsync(OutputFormatterWriteContext context)
        {
            var attendee = context.Object as Attendee;

            FormattableString card = $@"BEGIN:VCARD
VERSION: 3.0
N:{attendee.LastName};{attendee.FirstName};;;
FN:{attendee.FirstName} {attendee.LastName}
EMAIL;type=INTERNET;type=pref:{attendee.Email}
ORG:{attendee.Company};
END:VCARD";

            using (var writer = context.WriterFactory(context.HttpContext.Response.Body, Encoding.UTF8))
            {
                return(writer.WriteAsync(VCardEncoder.Encode(card)));
            }
        }