Esempio n. 1
0
        public async Task<IActionResult> Save(Salutation data)
        {
            if (!ModelState.IsValid) {
                return View("Edit", data);
            }

            await speechService.SaveSalutationAsync(data);

            return RedirectToAction("Index");
        }
Esempio n. 2
0
        public async Task<IActionResult> Edit(string Salutation)
        {
            Salutation model = await speechService.GetSalutationAsync(Salutation);

            if (model == null) {
                model = new Salutation
                {
                    IsNew = true
                };
            }

            return View(model);
        }
Esempio n. 3
0
        public async Task<Salutation> SaveSalutationAsync(Salutation data)
        {
            Salutation existing = await GetSalutationAsync(data.SalutationString);

            if (existing == null) {
                dataContext.Salutations.Add(data);
            } else {
                existing.Aggressiveness = data.Aggressiveness;
                dataContext.Salutations.Update(existing);
            }

            await dataContext.SaveChangesAsync();

            return existing;
        }