コード例 #1
0
        public JsonResult SendMessage(ContactViewModel message)
        {
            if (!ModelState.IsValid)
            {
                return(Json(new { success = false, issue = message, errors = ModelState.Values.Where(i => i.Errors.Count > 0) }));
            }

            bool result = ContactCommand.SendMessage(new ContactDto
            {
                UserEmail       = message.UserEmail,
                UserMessage     = message.UserMessage,
                UserPhoneNumber = message.UserPhoneNumber,
                UserName        = message.UserName,
                UserWebSite     = message.UserWebSite
            });

            return(Json(new { success = result }));
        }