Ejemplo n.º 1
0
        public async Task <bool> Create(Dtos.Newsletter model)
        {
            StringContent content = new StringContent(JsonSerializer.Serialize(model, typeof(Dtos.Newsletter)), Encoding.UTF8, "application/json");

            HttpResponseMessage httpResponse = await apiClient.PostAsync("/newsletter/create", content);

            return(httpResponse.IsSuccessStatusCode);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> NewsLetter(Dtos.Newsletter model)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView(model));
            }

            model.result.Success = await new Helpers.Newsletter(_configuration, HttpContext).Create(model);

            if (model.result.Success)
            {
                return(Ok(model));
            }

            return(BadRequest());
        }