コード例 #1
0
 /// <summary>
 /// Adds a new author to database.
 /// </summary>
 /// <param name="authorVM">Author view model.</param>
 /// <returns>Author identifier.</returns>
 public int AddAuthor(AuthorViewModel authorVM)
 {
     Author author = Mapper.Map<Author>(authorVM);
     this.AuthorRepository.Add(author);
     this.AuthorRepository.SaveChanges();
     return authorVM.Id = author.Id;
 }
コード例 #2
0
 /// <summary>
 /// Edits an author in database.
 /// </summary>
 /// <param name="authorVM">Author view model.</param>
 /// <returns>Author identifier.</returns>
 public int EditAuthor(AuthorViewModel authorVM)
 {
     Author author = this.AuthorRepository.FindById(authorVM.Id);
     Mapper.Map<AuthorViewModel, Author>(authorVM, author);
     this.AuthorRepository.SaveChanges();
     return author.Id;
 }
コード例 #3
0
ファイル: AuthorMapper.cs プロジェクト: vbogretsov/academy
 public static AuthorViewModel Map(User user)
 {
     AuthorViewModel viewModel = new AuthorViewModel();
     viewModel.Id = user.Id;
     viewModel.Email = user.Email;
     viewModel.FirstName = user.FirstName;
     viewModel.LastName = user.LastName;
     return viewModel;
 }
コード例 #4
0
ファイル: AuthorMapper.cs プロジェクト: vbogretsov/academy
 public static User Map(AuthorViewModel viewModel)
 {
     User user = new User();
     user.Id = viewModel.Id;
     user.Email = viewModel.Email;
     user.FirstName = viewModel.FirstName;
     user.LastName = viewModel.LastName;
     return user;
 }
コード例 #5
0
        //
        // GET: /Author/Edit/5
        public ActionResult Edit(int id)
        {
            Author author = new AuthorBusinessService().GetAuthorById(id);
            AuthorViewModel model = new AuthorViewModel();
            model.Id = author.Id;
            model.FirstName = author.FirstName;
            model.LastName = author.LastName;

            return View(model);
        }
コード例 #6
0
ファイル: Validator.cs プロジェクト: AmiraSh/BookCatalog
        /// <summary>
        /// Validates author view model.
        /// </summary>
        /// <param name="authorVM">Author view model.</param>
        public static void Validate(AuthorViewModel authorVM)
        {
            if (string.IsNullOrEmpty(authorVM.FirstName))
            {
                throw new InvalidFieldValueException("First name is required.", "FirstName");
            }

            if (string.IsNullOrEmpty(authorVM.SecondName))
            {
                throw new InvalidFieldValueException("Second name is required.", "SecondName");
            }
        }
コード例 #7
0
        public IEnumerable <AuthorViewModel> SearchAuthors(string searchString)
        {
            List <AuthorViewModel> modelsList = new List <AuthorViewModel>();
            IEnumerable <Author>   authors    = _authorRepository.FilterAuthors(searchString);

            foreach (Author author in authors)
            {
                AuthorViewModel model = _mapper.Map <AuthorViewModel>(author);
                modelsList.Add(model);
            }

            return(modelsList);
        }
コード例 #8
0
        public IEnumerable <AuthorViewModel> SortByName(SortOrder sortType, string sortedColumn)
        {
            IEnumerable <Author> authors = _authorRepository.SortByName(sortType, sortedColumn);
            var modelsList = new List <AuthorViewModel>();

            foreach (Author author in authors)
            {
                AuthorViewModel model = _mapper.Map <AuthorViewModel>(author);
                modelsList.Add(model);
            }

            return(modelsList);
        }
コード例 #9
0
        public ActionResult Edit(int id, AuthorViewModel authorViewModel)
        {
            try
            {
                _authorService.EditAuthor(id, authorViewModel);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
コード例 #10
0
        public ActionResult Create(AuthorViewModel authorViewModel)
        {
            try
            {
                _authorService.AddAuthor(authorViewModel);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
コード例 #11
0
        public IHttpActionResult GetAuthor(int id)
        {
            Author author = db.Authors.Find(id);

            if (author == null)
            {
                return(NotFound());
            }

            AuthorViewModel viewModelAuthor = new AuthorViewModel(author);

            return(Ok(viewModelAuthor));
        }
コード例 #12
0
 public IActionResult Edit(AuthorViewModel viewModel)
 {
     try
     {
         string imageDirectory = Path.Combine(webHostEnvironment.WebRootPath, "AuthorImage");
         authorService.Edit(viewModel.Id, viewModel.Description, viewModel.Image, imageDirectory);
         return(RedirectToAction("Details", new { id = viewModel.Id }));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
コード例 #13
0
ファイル: AuthorController.cs プロジェクト: charandommara/Tap
        public IActionResult Edit(long id)
        {
            AuthorViewModel model  = new AuthorViewModel();
            Author          author = repoAuthor.Get(id);

            if (author != null)
            {
                model.FirstName = author.FirstName;
                model.LastName  = author.LastName;
                model.Email     = author.Email;
            }
            return(View("Edit", model));
        }
コード例 #14
0
        public IActionResult Create(AuthorViewModel authorViewModel)
        {
            if (ModelState.IsValid)
            {
                var author = _mapper.Map <AuthorViewModel, Author>(authorViewModel);
                _unitOfWork.Authors.Add(author);
                _unitOfWork.Save();

                return(RedirectToAction("Index"));
            }

            return(View(authorViewModel));
        }
コード例 #15
0
 public ActionResult Delete(int id)
 {
     if (User.IsInRole("admin"))
     {
         AuthorViewModel author = _authorService.Get(id);
         if (author == null)
         {
             return(HttpNotFound());
         }
         return(View("Delete", author));
     }
     return(RedirectToAction("LogIn", "Account"));
 }
コード例 #16
0
ファイル: AuthorController.cs プロジェクト: sguo5668/Core
        public IActionResult EditAuthor(int id)
        {
            AuthorViewModel model  = new AuthorViewModel();
            Author          author = repoAuthor.Get(id);

            if (author != null)
            {
                model.FirstName = author.FirstName;
                model.LastName  = author.LastName;
                model.Email     = author.Email;
            }
            return(PartialView("_EditAuthor", model));
        }
コード例 #17
0
        public AuthorViewModel GetAuthor(int?id)
        {
            Author author = this.Context.Authors.Find(id);

            if (author == null)
            {
                return(null);
            }

            AuthorViewModel viewModel = Mapper.Map <Author, AuthorViewModel>(author);

            return(viewModel);
        }
コード例 #18
0
        public async Task <IActionResult> Create([FromBody] AuthorViewModel author)
        {
            try
            {
                await _authorService.Create(author);

                return(Ok());
            }
            catch (Exception e)
            {
                return(BadRequest(e.InnerException.Message));
            }
        }
コード例 #19
0
        public void UpdateAuthorsTest()
        {
            var changeList = new AuthorViewModel[]
            {
                new AuthorViewModel(new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), "村杉 周治"),
                new AuthorViewModel(new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2), "角屋 譲司"),
                new AuthorViewModel(new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), "松嵜 紀昭"),
                new AuthorViewModel(new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4), "司馬 悠"),
                new AuthorViewModel(new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5), "今藤 勝一"),
                new AuthorViewModel(new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1), "Duy Owen Lovell"),
                new AuthorViewModel(new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2), "Cool Hong Rajesh"),
                new AuthorViewModel(new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3), "Rafi Nath Post"),
                new AuthorViewModel(new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4), "Raven Jude Heard"),
                new AuthorViewModel(new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 5), "Jeric Kelvin Yeager")
            };

            AuthorFacade.Update(changeList[0]);
            AuthorFacade.Update(changeList[1]);
            AuthorFacade.Update(changeList[2]);
            AuthorFacade.Update(changeList[3]);
            AuthorFacade.Update(changeList[4]);
            AuthorFacade.Update(changeList[5]);
            AuthorFacade.Update(changeList[6]);
            AuthorFacade.Update(changeList[7]);
            AuthorFacade.Update(changeList[8]);
            AuthorFacade.Update(changeList[9]);

            var items = AuthorFacade.FindAll();

            Assert.That(items.Count, Is.EqualTo(20));
            Assert.That(items.ElementAt(0), Is.EqualTo(changeList[0]));
            Assert.That(items.ElementAt(1), Is.EqualTo(changeList[1]));
            Assert.That(items.ElementAt(2), Is.EqualTo(changeList[2]));
            Assert.That(items.ElementAt(3), Is.EqualTo(changeList[3]));
            Assert.That(items.ElementAt(4), Is.EqualTo(changeList[4]));
            Assert.That(items.ElementAt(5), Is.EqualTo(_authors[5]));
            Assert.That(items.ElementAt(6), Is.EqualTo(_authors[6]));
            Assert.That(items.ElementAt(7), Is.EqualTo(_authors[7]));
            Assert.That(items.ElementAt(8), Is.EqualTo(_authors[8]));
            Assert.That(items.ElementAt(9), Is.EqualTo(_authors[9]));
            Assert.That(items.ElementAt(10), Is.EqualTo(changeList[5]));
            Assert.That(items.ElementAt(11), Is.EqualTo(changeList[6]));
            Assert.That(items.ElementAt(12), Is.EqualTo(changeList[7]));
            Assert.That(items.ElementAt(13), Is.EqualTo(changeList[8]));
            Assert.That(items.ElementAt(14), Is.EqualTo(changeList[9]));
            Assert.That(items.ElementAt(15), Is.EqualTo(_authors[15]));
            Assert.That(items.ElementAt(16), Is.EqualTo(_authors[16]));
            Assert.That(items.ElementAt(17), Is.EqualTo(_authors[17]));
            Assert.That(items.ElementAt(18), Is.EqualTo(_authors[18]));
            Assert.That(items.ElementAt(19), Is.EqualTo(_authors[19]));
        }
コード例 #20
0
        public static List <BookViewModel> BooksParser(List <Book> books)
        {
            List <BookViewModel> booksVM  = new List <BookViewModel>();
            List <CopyViewModel> copiesVM = WebApiClient.GetAllCopies();

            foreach (var book in books)
            {
                BookViewModel bookVM = new BookViewModel();
                bookVM.Authors   = new List <AuthorViewModel>();
                bookVM.Publisher = new PublisherViewModel();
                bookVM.Category  = new CategoryViewModel();
                bookVM.Copies    = new List <CopyViewModel>();

                bookVM.BookId        = book.BookId;
                bookVM.Title         = book.Title;
                bookVM.Description   = book.Description;
                bookVM.IsAvailable   = book.IsAvailable;
                bookVM.Language      = book.Language;
                bookVM.ISBN_No       = book.ISBN_No;
                bookVM.IsDeleted     = book.IsDeleted;
                bookVM.PublishedYear = book.PublishedYear;

                foreach (var author in book.Authors)
                {
                    AuthorViewModel authorVM = new AuthorViewModel();
                    authorVM.AuthorId    = author.AuthorId;
                    authorVM.Name        = author.Name;
                    authorVM.Description = author.Description;

                    bookVM.Authors.Add(authorVM);
                }

                //bookVM.Author.AuthorId = book.Author.AuthorId;
                //bookVM.Author.Name = book.Author.Name;
                //bookVM.Author.Description = book.Author.Description;

                bookVM.Publisher.PublisherId = book.Publisher.PublisherId;
                bookVM.Publisher.Name        = book.Publisher.Name;
                bookVM.Publisher.Description = book.Publisher.Description;

                bookVM.Category.CategoryId  = book.Category.CategoryId;
                bookVM.Category.Name        = book.Category.Name;
                bookVM.Category.Description = book.Category.Description;
                bookVM.ImagePath            = book.ImagePath;
                bookVM.Copies = copiesVM.Where(x => x.Book.BookId == book.BookId).ToList();

                booksVM.Add(bookVM);
            }

            return(booksVM);
        }
コード例 #21
0
        public ActionResult author(string id)
        {
            //Get Current User Info
            if (WebSecurity.IsAuthenticated)
            {
                ViewBag.CurrentUser = servicesManager.AccountFrontService.GetSimpleUserById(WebSecurity.CurrentUserId);
            }

            //get the article info
            AuthorViewModel view_model = servicesManager.AuthorFrontService.GetAuthorByURL(id);

            if (view_model == null || !view_model.IsProfileEnabled)
            {
                throw new HttpException(404, "Page Not Found");
            }

            ////Get latest articles list
            //List<int> except = new List<int>();
            //except.Add(view_model.ArticleId);
            //ViewBag.LatestArticlesLeft = servicesManager.ArticleFrontService.GetLatestArticles(6, ArticleService.ArticleThumbWidth3, ArticleService.ArticleThumbHeight3, except);

            //List<int> except_list = ((List<ListArticleViewModel>)ViewBag.LatestArticlesLeft).Select(a => a.ArticleId).ToList();
            //except_list.Add(view_model.ArticleId);
            ////Get related articles list top
            ////  ViewBag.RelatedArticlesTop = servicesManager.ArticleFrontService.GetRelatedArticles(view_model.ArticleId,view_model.Title, 6, ArticleService.ArticleThumbWidth6, ArticleService.ArticleThumbHeight6);

            ////Get related recommended articles bottom
            //ViewBag.RelatedArticlesBottom = servicesManager.ArticleFrontService.GetRelatedArticles(view_model.ArticleId, view_model.Title, 6, ArticleService.ArticleThumbWidth4, ArticleService.ArticleThumbHeight4, except_list);



            ////Fill Bread Crumb
            BreadCrumbViewModel bread_crumb = new BreadCrumbViewModel();

            bread_crumb.Items = new List <BreadCrumbItemViewModel>();
            bread_crumb.Items.Add(new BreadCrumbItemViewModel()
            {
                Text = "الرئيسية", URL = "/"
            });
            bread_crumb.Items.Add(new BreadCrumbItemViewModel()
            {
                Text = "الكتاب"
            });
            bread_crumb.Items.Add(new BreadCrumbItemViewModel()
            {
                Text = view_model.Title, URL = Url.Action("author", "Author", new { id = view_model.URL })
            });
            ViewBag.BreadCrumb = bread_crumb;

            return(View(view_model));
        }
コード例 #22
0
        public async Task <IActionResult> Edit(AuthorViewModel viewModel)
        {
            var author = await _authorService.UpdateAuthor(viewModel);

            if (_authorService.IsSuccessful() == false)
            {
                AddModelError(_authorService.GetModelErrors());
                return(View(nameof(Edit), author));
            }
            else
            {
                return(RedirectToAction(nameof(Index)));
            }
        }
コード例 #23
0
        public ActionResult Create([Bind(Include = "Id,authorName")] author author)
        {
            AuthorViewModel authorVm = new AuthorViewModel();

            if (ModelState.IsValid)
            {
                authorVm.Name = author.authorName;
                db.authors.Add(author);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(authorVm));
        }
コード例 #24
0
        public ActionResult Edit(AuthorViewModel authorEdit)
        {
            Author dbAuthor = authorRepository.GetByID(authorEdit.ID);

            if (dbAuthor == null)
            {
                //create new author if none exists
                dbAuthor = new Author();
            }
            dbAuthor.Name = authorEdit.Name;
            authorRepository.Save(dbAuthor);

            return(RedirectToAction("Index"));
        }
コード例 #25
0
        public Author AuthorViewModelToAuthor(AuthorViewModel VM)
        {
            int      Id   = VM.Id;
            string   Name = VM.Name;
            DateTime DOB  = VM.DOB;
            string   Info = null;

            if (!string.IsNullOrEmpty(VM.Info))
            {
                Info = VM.Info;
            }

            return(new Author(Id, Name, DOB, Info));
        }
コード例 #26
0
        public IViewComponentResult Invoke(AuthorViewModel model)
        {
            var isAdmin = User != null && User.IsInRole("Admin");

            if (isAdmin)
            {
                return(new HtmlContentViewComponentResult(
                           new HtmlString($"<a href=\"/authors/Index/{model.Id}\" class=\"btn btn-info fa fa-arrow-left\"> </a> " +
                                          $"<a href=\"/authors/Edit/{model.Id}\" class=\"btn btn-success fa fa-pencil\"> </a> ")));
            }

            return(new HtmlContentViewComponentResult(
                       new HtmlString($"<a href=\"/authors/Index/{model.Id}\" class=\"btn btn-info fa fa-arrow-left\"> </a>")));
        }
コード例 #27
0
        public AuthorViewModel GetAuthor(int id)
        {
            Author author = _context.Authors.Where(x => x.Author_id == id).FirstOrDefault();

            AuthorViewModel authorViewModel = new AuthorViewModel()
            {
                Author_id     = author.Author_id,
                Date_Of_Birth = author.Date_Of_Birth,
                First_Name    = author.First_Name,
                Last_Name     = author.Last_Name
            };

            return(authorViewModel);
        }
コード例 #28
0
        public AuthorViewModel Create(AuthorViewModel entity)
        {
            var mappedEntityForCreate = Mapper.Map <AuthorViewModel, Questionare>(entity);

            if (UnitOfWork.Authors.Exists(e => e.User.UserName == mappedEntityForCreate.User.UserName))
            {
                throw new DbEntityValidationException();
            }

            var unmappedCreatedEntity = UnitOfWork.Authors.Create(mappedEntityForCreate);
            var mappedCreatedEntity   = Mapper.Map <Questionare, AuthorViewModel>(unmappedCreatedEntity);

            return(mappedCreatedEntity);
        }
コード例 #29
0
        public IHttpActionResult Put(AuthorViewModel author)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            AutoMapper.Mapper.CreateMap <AuthorViewModel, Author>();
            db.Entry(AutoMapper.Mapper.Map <AuthorViewModel, Author>(author)).State
                = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #30
0
        public static AuthorViewModel ConvertToViewModel(this Author model)
        {
            AuthorViewModel viewModel = new AuthorViewModel();

            viewModel.AuthorId = model.Id;
            viewModel.Name     = model.Name;
            if (model.Nationality != null)
            {
                viewModel.NationalityId   = model.Nationality.Id;
                viewModel.NationalityName = model.Nationality.Name;
            }

            return(viewModel);
        }
コード例 #31
0
        public ActionResult CreateAndEdit(AuthorViewModel authorsModel)
        {
            var authorBO = mapper.Map <AuthorBO>(authorsModel);

            if (ModelState.IsValid)
            {
                authorBO.Save();
                return(RedirectToActionPermanent("Index", "Author"));
            }
            else
            {
                return(View(authorsModel));
            }
        }
コード例 #32
0
        public async Task <IActionResult> Index()
        {
            AuthorViewModel model = new AuthorViewModel();

            try
            {
                model.Authors = await _authorService.GetAll();
            }
            catch (Exception ex)
            {
            }

            return(View(model));
        }
コード例 #33
0
 public ActionResult Create([Bind(Include = "Id,FirstName,LastName,Biography")] AuthorViewModel authorViewModel)
 {
     if (ModelState.IsValid)
     {
         IMapper mapper = mapperConfig.CreateMapper();
         Author  author = mapper.Map <Author>(authorViewModel);
         authorService.Insert(author);
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View("Form", authorViewModel));
     }
 }
コード例 #34
0
        public ActionResult Edit(AuthorViewModel model)
        {
            var authorBO = mapper.Map <AuthorBO>(model);

            if (ModelState.IsValid)
            {
                authorBO.Save();
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(model));
            }
        }
コード例 #35
0
        public ActionResult Edit(int id = 0)
        {
            Author author = authorRepository.GetByID(id);

            AuthorViewModel model = new AuthorViewModel();

            if (author != null)
            {
                model      = new AuthorViewModel();
                model.Name = author.Name;
                model.ID   = author.ID;
            }
            return(View(model));
        }
コード例 #36
0
        public void Create(AuthorViewModel authorViewModel)
        {
            authorViewModel.Id = Guid.NewGuid();
            Author author = new Author
            {
                Id          = authorViewModel.Id,
                FirstName   = authorViewModel.FirstName,
                LastName    = authorViewModel.LastName,
                Patronymic  = authorViewModel.Patronymic,
                Abbreviated = GenerateAbbreviated(authorViewModel)
            };

            _authorRepository.Create(author);
        }
コード例 #37
0
        //
        // GET: /Author/
        public ActionResult Index()
        {
            AuthorBusinessService service = new AuthorBusinessService();
            List<Author> authors = service.GetAuthors();

            List<AuthorViewModel> models = new List<AuthorViewModel>();

            foreach (Author author in authors)
            {
                AuthorViewModel model = new AuthorViewModel();
                model.Id = author.Id;
                model.FirstName = author.FirstName;
                model.LastName = author.LastName;

                models.Add(model);
            }

            return View(models);
        }
コード例 #38
0
        public ActionResult Create(AuthorViewModel model)
        {
            try
            {
                // TODO: Add insert logic here

                Author author = new Author();
                author.Id = model.Id;
                author.FirstName = model.FirstName;
                author.LastName = model.LastName;

                AuthorBusinessService service = new AuthorBusinessService();
                service.SaveAuthor(author);

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
コード例 #39
0
 public JsonResult Destroy([DataSourceRequest]DataSourceRequest request, AuthorViewModel authorViewModel)
 {
     this.DomainModel.Delete(authorViewModel.Id);
     return this.Json(new[] { authorViewModel }.ToDataSourceResult(request, this.ModelState));
 }
コード例 #40
0
 /// <summary>
 /// Adds or edits an author.
 /// </summary>
 /// <param name="authorVM">Author view model.</param>
 /// <returns>Author identifier.</returns>
 public int Manage(AuthorViewModel authorVM)
 {
     return authorVM.Id == 0 ? this.AddAuthor(authorVM) : this.EditAuthor(authorVM);
 }
コード例 #41
0
 public int Manage(AuthorViewModel authorVM)
 {
     return this.DomainModel.Manage(authorVM);
 }
コード例 #42
0
        public JsonResult Manage(AuthorViewModel authorVM)
        {
            try
            {
                Validator.Validate(authorVM);
            }
            catch (InvalidFieldValueException exception)
            {
                ModelState.AddModelError(exception.Field, exception.ValidationMessage);
                return this.Json(new { error = exception.ValidationMessage });
            }

            this.DomainModel.Manage(authorVM);
            return this.Json(new
            {
                Id = authorVM.Id,
                FirstName = authorVM.FirstName,
                SecondName = authorVM.SecondName,
                BooksCount = authorVM.BooksCount,
                Books = this.DomainModel.GetBooks(authorVM.Id)
            });
        }
コード例 #43
0
        public JsonResult KendoManage([DataSourceRequest]DataSourceRequest request, AuthorViewModel authorViewModel)
        {
            try
            {
                Validator.Validate(authorViewModel);
            }
            catch (InvalidFieldValueException exception)
            {
                this.ModelState.AddModelError(exception.Field, exception.ValidationMessage);
                return this.Json(new[] { authorViewModel }.ToDataSourceResult(request, this.ModelState));
            }

            this.DomainModel.Manage(authorViewModel);
            return this.Json(new[] { authorViewModel }.ToDataSourceResult(request, this.ModelState));
        }
コード例 #44
0
 /// <summary>
 /// Adds or edits an author.
 /// </summary>
 /// <param name="authorVM">Author view model.</param>
 public void Manage(AuthorViewModel authorVM)
 {
     int authorId = this.DomainModel.Manage(Mapper.Map<AuthorWebService.AuthorViewModel>(authorVM));
     authorVM.Id = authorId;
 }