Beispiel #1
0
        public void Update(SMTPSettingItemViewModel item)
        {
            var x = repo.FindById(item.SMTPSettingId);

            x.SMTPUsername = item.SMTPUsername;
            x.SMTPPassword = item.SMTPPassword;
            x.SMTPServer   = item.SMTPServer;
            x.SMTPPort     = item.SMTPPort;
            x.EnableSSL    = item.EnableSSL;
            x.IsActive     = item.IsActive;

            repo.Update(x);
        }
Beispiel #2
0
        protected void Save(SMTPSettingItemViewModel item)
        {
            try
            {
                if (item.SMTPSettingId > 0)
                {
                    Service.Update(item);
                    var index = Model.FindIndex(x => x.SMTPSettingId == this.currentItem.SMTPSettingId);
                    Model[index] = item;
                }
                else
                {
                    if (Model.Count() > 0)
                    {
                        item.SMTPSettingId = Model.Select(r => r.SMTPSettingId).Max() + 1;
                    }
                    else
                    {
                        item.SMTPSettingId = 1;
                    }

                    var newItem = Service.Create(item);
                    if (newItem != null)
                    {
                        Model.Add(newItem);
                    }
                }
                StateHasChanged();
            }
            catch (Exception e)
            {
                Logger.LogError(e, $"{GetUserName()}*Error: SMTPSettingPage/Save");
                ErrorModel.IsOpen       = true;
                ErrorModel.ErrorContext = e.StackTrace;
                ErrorModel.ErrorMessage = e.Message;
                IsFailed = true;
                StateHasChanged();
            }
        }
Beispiel #3
0
        protected async Task Remove(SMTPSettingItemViewModel item)
        {
            var result = await MatDialogService.AskAsync($"Möchten Sie den Datensatz wirklich löschen?", new string[] { "Löschen", "Abbrechen" });

            if (result == "Löschen")
            {
                try
                {
                    Service.Delete(item);
                    Model.Remove(item);
                }

                catch (Exception e)
                {
                    Logger.LogError(e, $"{GetUserName()}*Error: SMTPSettingPage/Remove");
                    ErrorModel.IsOpen       = true;
                    ErrorModel.ErrorContext = e.StackTrace;
                    ErrorModel.ErrorMessage = e.Message;
                    IsFailed = true;
                    StateHasChanged();
                }
            }
        }
Beispiel #4
0
        public SMTPSettingItemViewModel Create(SMTPSettingItemViewModel item)
        {
            var newItem = repo.Create(item.Item);

            return(Convert(newItem));
        }
Beispiel #5
0
        public void Delete(SMTPSettingItemViewModel item)
        {
            var x = repo.FindById(item.SMTPSettingId);

            repo.Remove(x);
        }
Beispiel #6
0
 public void CreateItem()
 {
     currentItem                = new SMTPSettingItemViewModel();
     EditViewModel.Model        = currentItem;
     EditViewModel.DialogIsOpen = true;
 }
Beispiel #7
0
 protected void Edit(SMTPSettingItemViewModel r)
 {
     currentItem                = (SMTPSettingItemViewModel)r.Clone();
     EditViewModel.Model        = currentItem;
     EditViewModel.DialogIsOpen = true;
 }