Ejemplo n.º 1
0
        public ActionResult EditAuthor(BookStoreAdmin.ViewModels.Author author)
        {
            BookStoreAdmin.ViewModels.Response <BookStoreAdmin.ViewModels.Author> response = new ViewModels.Response <BookStoreAdmin.ViewModels.Author>();
            author = BookStoreAdmin.BAL.Author.EditAuthor(author);

            response.success      = true;
            response.data         = author;
            response.errorMessage = null;

            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public static BookStoreAdmin.ViewModels.Author EditAuthor(BookStoreAdmin.ViewModels.Author author)
        {
            BookStoreAdmin.Models.author objAuthor = new Models.author();

            using (BookStoreAdmin.Models.BookStoreAdminEntities1 context = new BookStoreAdminEntities1())
            {
                objAuthor             = context.authors.Find(author.id);
                objAuthor.first_name  = author.first_name;
                objAuthor.last_name   = author.last_name;
                objAuthor.description = author.description;
                context.SaveChanges();
            }
            return(author);
        }