how do we send emails and sms after saving data using breeze

209 views Asked by At

How do we send email and sms after saving the data using breeze. It is working fine with saving information in database, but i need to do some more operations after saving data. Can anyone help me solve this issue.

var saveChanges = function () {
   return manager.saveChanges()
     .then(saveSucceeded)
     .fail(saveFailed);    
    function saveSucceeded(saveResult) {
    log('Saved data successfully', saveResult, true);
  }

  function saveFailed(error) {
    var msg = 'Save failed: ' + getErrorMessages(error);
   logError(msg, error);
   error.message = msg;
   throw error;
  }
};

public SaveResult SaveChanges(JObject saveBundle)
{
   return _contextProvider.SaveChanges(saveBundle);
}

Thank you

1

There are 1 answers

3
PW Kad On

From everything I have seen Breeze and Durandal are not the droids you are looking for... They are both JavaScript libraries and you cannot send an e-mail from the browser, that I know of.

You need to do an Ajax call or something back to your controller to send an e-mail with your controller or from C# -

Sending email in .NET through Gmail

As @Pawel also pointed out, if you intercept the save in your controller, you could also trigger an e-mail there.