-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAuthorController.cs
65 lines (58 loc) · 3.94 KB
/
AuthorController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace BookManagement.Controllers
{
[Route("api/[controller]")]
public class AuthorController : Controller
{
private static List<Author> _myAuthors = new List<Author>
{
new Author()
{
ID = 1,
Name = "Dale Carnegie",
},
new Author()
{
ID = 2,
Name = "Oscar Wilde",
},
};
[HttpGet("")]
public IEnumerable<Author> AllAuthors()
{
return _myAuthors;
}
[HttpGet("{id}")]
public Author Get(int id)
{
Author match = _myAuthors.Find(n => n.ID == id);
if (match != null)
{
switch (match.ID)
{
case 1:
match.Description = @"The Art of Public Speaking is a fantastic introduction to public speaking by the master of the art, Dale Carnegie. Public speaking is the process of speaking to a group of people in a structured, deliberate manner intended to inform, influence, or entertain the listeners. It is closely allied to ""presenting"", although the latter has more of a commercial connotation.
In public speaking, as in any form of communication, there are five basic elements, often expressed as ""who is saying what to whom using what medium with what effects?"" The purpose of public speaking can range from simply transmitting information, to motivating people to act, to simply telling a story. Good orators should be able to change the emotions of their listeners, not just inform them. Public speaking can also be considered a discourse community. Interpersonal communication and public speaking have several components that embrace such things as motivational speaking, leadership/personal development, business, customer service, large group communication, and mass communication. Public speaking can be a powerful tool to use for purposes such as motivation, influence, persuasion, informing, translation, or simply entertaining. A confident speaker is more likely to use this as excitement and create effective speech thus increasing their overall ethos.";
break;
case 2:
match.Description = @"The Picture of Dorian Gray scandalized readers when it was first published in 1890. Written in Wilde’s signature style, the story has gone on to become an enduring tale of man’s hubris and narcissism.
The well-known artist Basil Hallward meets the young Dorian Gray in the stately London home of his aunt, Lady Brandon. Basil becomes immediately infatuated with Dorian, who is cultured, wealthy, and remarkably beautiful. Such beauty, Basil believes, is responsible for a new mode of art, and he decides to paint a portrait of the young man. While finishing the painting, Basil reluctantly introduces Dorian to his friend Lord Henry Wotton, a man known for scandal and exuberance. Wotton inspires Dorian to live life through the senses, to feel beauty in everyday experience. Dorian becomes enthralled by Wotton’s ideas, and more so becomes obsessed with remaining young and beautiful. He expresses a desire to sell his soul and have the portrait of him age, while he, the man, stays eternally young. A tragic story of hedonism and desire, The Picture of Dorian Gray is Oscar Wilde’s only published novel.";
break;
default:
break;
}
}
return match;
}
public class Author
{
public int ID { get; set; }
public string Name { get; set; }
public string Description { get; set; }
}
}
}