Пример #1
0
        public IActionResult Edit(string id, AppInputModel app)
        {
            if (id != app.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    var result = _appService.UpdateApi(app);
                    if (result != null)
                    {
                        _appService.Update(result);
                    }
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AppExists(app.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(app));
        }
Пример #2
0
 public IActionResult Create(AppInputModel app)
 {
     if (ModelState.IsValid)
     {
         var createdApp = _appService.CreateApi(app);
         _appService.Create(createdApp);
         return(RedirectToAction(nameof(Index)));
     }
     return(View(app));
 }