Ejemplo n.º 1
0
 public ActionResult AuthorUpdate(Author author)
 {
     try
     {
         authorsDb.Update(author);
         messagesAuthorTable = Resources.Resource.MessageUpdated;
         return(RedirectToAction("AuthorsTable", "Admin"));
     }
     catch
     {
         messagesAuthorTable = Resources.Resource.Error;
         return(RedirectToAction("AuthorsTable", "Admin"));
     }
 }
        protected override void Edit()
        {
            int    id     = _ui.ReadInt("Author ID", 0);
            Author author = _authorDao.Get(id);

            if (author == null)
            {
                _ui.PrintLn("Author not found");
                return;
            }
            _ui.PrintLn(author);

            string   firstName = _ui.ReadString("First name", author.FirstName);
            string   lastName  = _ui.ReadString("Last name", author.LastName);
            DateTime birthDate = _ui.ReadDate("Birth date", author.BirthDate);

            author.FirstName = firstName;
            author.LastName  = lastName;
            author.BirthDate = birthDate;
            _authorDao.Update(author);
        }