Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre,Sede")] Editoriales editorial)
        {
            if (id != editorial.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _client.Update(editorial);
                }
                catch
                {
                    if (!EditorialesExists(editorial.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            return(View(editorial));
        }
Esempio n. 2
0
        public async Task <Editoriales> SaveEditorial(Editoriales editorial)
        {
            _logger.LogDebug("Editoriales client created, request = GetById{@id}", editorial.Id);
            var _editorial = await _editoriales.GetById(editorial.Id);

            _logger.LogDebug("Editoriales response {@response}", _editorial);

            if (_editorial is null)
            {
                _logger.LogDebug("Editoriales client created, request = Create{@editorial}", editorial);
                _editorial = await _editoriales.Create(editorial);

                _logger.LogDebug("Editoriales response {@response}", _editorial);
            }
            else
            {
                _logger.LogDebug("Editoriales client created, request = Update{@editorial}", editorial);
                _editorial = await _editoriales.Update(editorial);

                _logger.LogDebug("Editoriales response {@response}", _editorial);
            }

            return(_editorial);
        }