예제 #1
0
        public GetAuthorDTO GetAuthorById(int id)
        {
            Author       author    = _Repository.GetById(id);
            GetAuthorDTO authorDTO = null;

            if (id != 0)
            {
                authorDTO = new GetAuthorDTO()
                {
                    id            = author.id,
                    name          = author.name,
                    dob           = author.dob,
                    qualification = author.qualification,
                    profession    = author.profession
                };
            }
            return(authorDTO);
        }
예제 #2
0
        public IList <GetAuthorDTO> GetAuthors()
        {
            IList <Author>       authors    = _Repository.Table.ToList <Author>();
            IList <GetAuthorDTO> authorList = new List <GetAuthorDTO>();

            foreach (var author in authors)
            {
                GetAuthorDTO authorDTO = new GetAuthorDTO()
                {
                    id            = author.id,
                    name          = author.name,
                    dob           = author.dob,
                    qualification = author.qualification,
                    profession    = author.profession
                };
                authorList.Add(authorDTO);
            }
            return(authorList);
        }
예제 #3
0
        // GET: Authors/Delete/5
        public ActionResult Delete(int id)
        {
            GetAuthorDTO author = _authorService.GetAuthorById(id);

            return(View(author));
        }