angular.module('ngBoilerplate.emailDomain', ['ui.router', 'ngResource'])
.config(function($stateProvider) {

})
.factory('emailDomainService', function($resource) {
    var service = {};
    service.getAllEmailDomains = function() {
        console.log("emailDomain - getAllEmailDomains");
          var EmailDomains = $resource("/basic-web-app/rest/emailDomain");
          return EmailDomains.get().$promise.then(function(data) {
            return data.emailDomains;
          });
    };
    service.sendEmailDomain = function(emailDomain, success, failure) {
        console.log("emailDomain - sendEmailDomain");
        var newEmailDomain = $resource("/basic-web-app/rest/emailDomain");
        newEmailDomain.save({}, emailDomain, success, failure);
    };
    
    service.uploadExcel = function(excelCsv, success, failure) {
        console.log("emailDomain - uploadExcel");
        var ExcelCsv = $resource("/basic-web-app/rest/emailDomain/excel");
        ExcelCsv.save({}, excelCsv, success, failure);
    };
    
    return service;
});
