public IActionResult ContactMe(ContactMeMessage viewModel) { if (!ModelState.IsValid) { return(View("Partials/_ContactPartial", viewModel)); } _emailService.ContactMe(viewModel.Name, viewModel.Email, viewModel.Message); return(RedirectToAction(nameof(Index))); }
public JsonResult ContactMe([FromBody] ContactMeViewModel contact) { _emailService.ContactMe(contact); return(Json(new { Error = false, contact })); }