public ModelViewConfiguration UpdateURLY(ModelViewConfiguration data, int[] Usuarios) { var objRepository = new RepositoryConfiguration(); var objRepositoryMsj = new RepositoryReceivers(); var config = objRepository.Get(data.ConfigurationID); config.Title = data.Title; config.Message = data.Message; config.Url = data.Url; config.ModifyDate = DateTime.UtcNow; objRepository.Update(config); List <int> IDS = objRepositoryMsj.GetByConfiguration(config.ConfigurationID).Select(a => a.UserID).ToList(); objRepositoryMsj.Delete(IDS, config.ConfigurationID); foreach (var item in Usuarios) { EntityReceivers receivers = new EntityReceivers() { ConfigurationID = config.ConfigurationID, UserID = item, MessageCreate = true, CreateDate = DateTime.Now, ModifyDate = DateTime.UtcNow }; receivers = objRepositoryMsj.Insert(receivers); } return(data); }
public ModelViewConfiguration InsertURLY(ModelViewConfiguration data, int[] Usuarios) { var objRepository = new RepositoryConfiguration(); var objRepositoryMsj = new RepositoryReceivers(); EntityConfiguration config = new EntityConfiguration() { ConfigurationID = data.ConfigurationID, Title = data.Title, Message = data.Message, Url = data.Url, Status = true, CreateDate = DateTime.Now, ModifyDate = DateTime.UtcNow }; config = objRepository.Insert(config); foreach (var item in Usuarios) { EntityReceivers receivers = new EntityReceivers() { ConfigurationID = config.ConfigurationID, UserID = item, MessageCreate = true, CreateDate = DateTime.Now, ModifyDate = DateTime.UtcNow }; receivers = objRepositoryMsj.Insert(receivers); } return(data); }
public ModelViewConfiguration Insert(string fileUpload, ModelViewConfiguration data, string path, int[] Usuarios) { string fileName = data.Url; string combinePath = path + fileName; System.IO.File.Copy(fileUpload, combinePath, true); System.IO.File.Delete(fileUpload); var objRepository = new RepositoryConfiguration(); var objRepositoryMsj = new RepositoryReceivers(); EntityConfiguration config = new EntityConfiguration() { ConfigurationID = data.ConfigurationID, Title = data.Title, Message = data.Message, Url = GlobalConfiguration.urlRequest + "Content/Notification/" + fileName, Status = true, CreateDate = DateTime.Now, ModifyDate = DateTime.UtcNow }; config = objRepository.Insert(config); foreach (var item in Usuarios) { EntityReceivers receivers = new EntityReceivers() { ConfigurationID = config.ConfigurationID, UserID = item, MessageCreate = true, CreateDate = DateTime.Now, ModifyDate = DateTime.UtcNow }; receivers = objRepositoryMsj.Insert(receivers); } return(data); }
public ModelViewConfiguration Update(string fileUpload, ModelViewConfiguration data, string path, int[] Usuarios) { string fileName = data.Url; if (File.Exists(fileUpload)) { string combinePath = path + fileName; System.IO.File.Copy(fileUpload, combinePath, true); System.IO.File.Delete(fileUpload); } var objRepository = new RepositoryConfiguration(); var objRepositoryMsj = new RepositoryReceivers(); var config = objRepository.Get(data.ConfigurationID); config.Title = data.Title; config.Message = data.Message; config.Url = File.Exists(fileUpload) ? GlobalConfiguration.urlRequest + "Content/Notification/" + data.Url: config.Url; config.ModifyDate = DateTime.UtcNow; objRepository.Update(config); List <int> IDS = objRepositoryMsj.GetByConfiguration(config.ConfigurationID).Select(a => a.UserID).ToList(); objRepositoryMsj.Delete(IDS, config.ConfigurationID); foreach (var item in Usuarios) { EntityReceivers receivers = new EntityReceivers() { ConfigurationID = config.ConfigurationID, UserID = item, MessageCreate = true, CreateDate = DateTime.Now, ModifyDate = DateTime.UtcNow }; receivers = objRepositoryMsj.Insert(receivers); } return(data); }
public ModelViewReceivers Update(EntityReceivers data) { return((ModelViewReceivers) new RepositoryReceivers().Update((EntityReceivers)data)); }