Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, SubscriptionFormModel model)
        {
            await this.subscriptions.EditAsync(id, model.Name, model.Department, model.Type, model.Language);

            this.TempData.AddSuccessMessage(string.Format(WebConstants.TempDataEditCommentText, ModelName, string.Empty));

            return(this.RedirectToAction(nameof(this.Subscriptions)));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create(SubscriptionFormModel model)
        {
            if (await this.subscriptions.UniqueCheckAsync(model.Name))
            {
                this.TempData.AddWarningMessage(string.Format(WebConstants.TempDataAlreadyExistsText, ModelName, model.Name));

                return(this.RedirectToAction(nameof(this.Create)));
            }

            await this.subscriptions.CreateAsync(model.Name, model.Department, model.Type, model.Language);

            this.TempData.AddSuccessMessage(string.Format(WebConstants.TempDataCreateCommentText, ModelName, string.Empty));

            return(this.RedirectToAction(nameof(this.Subscriptions)));
        }