public async Task <IActionResult> Save([FromBody] ContactViewModel model)
        {
            ContactViewModel result;

            try
            {
                if (model.Id == 0)
                {
                    result = await Task.FromResult(_service.Add(model.MapTo <Contact>()));
                }
                else
                {
                    result = await Task.FromResult(_service.Update(model.MapTo <Contact>()));
                }
                return(Ok(result.MapTo <ContactViewModel>()));
            }
            catch (Exception e)
            {
                return(BadRequest($"Error while saving Contact {e.Message}"));
            }
        }
        public async Task <IActionResult> Remove([FromBody] ContactViewModel model)
        {
            try
            {
                await Task.Run(() => _service.Remove(model.MapTo <Contact>()));

                return(Ok());
            }
            catch
            {
                return(BadRequest("Error while deleting Contact"));
            }
        }
 public void SendEmail(ContactViewModel contactModel)
 {
     try
     {
         var contact = contactModel.MapTo <Contact>();
         _emailService.SendEmail(contact.Email, "*****@*****.**", contact.Subject, $"{contact.Name}<br />{contact.Message}");
         //_service.SendEmail(contact);
     }
     catch (System.Exception e)
     {
         throw e;
     }
 }