Skip to content

Instantly share code, notes, and snippets.

View JohannesSundqvist's full-sized avatar

Johannes JohannesSundqvist

View GitHub Profile
// Add a student to the list
[HttpPost("AddStudent")]
public HttpResponseMessage AddStudent(string student)
{
if(!string.IsNullOrWhiteSpace(student))
{
Student newStud = JsonConvert.DeserializeObject<Student>(student);
DataService.AddStudent(newStud);
return new HttpResponseMessage(HttpStatusCode.OK);
// Add a student to the list
public async Task<bool> AddStudent(Student student)
{
StringContent serializedObj = new StringContent(JsonConvert.SerializeObject(student));
var response = await _client.PostAsync("AddStudent", serializedObj);
return response.IsSuccessStatusCode;
}
$(button1).click(function() {
$(button2).click(function() {
$(button3).click(function() {
$(button4).click(function() {
public IQueryable<Post> GetCategories()
{
var query = (from p in Post
select new Post
{
Category = p.Category,
}).Distinct();
return query;
}
public IQueryable<Post> GetPost()
{
var query = (from p in Post
select new Post
{
Id = p.Id,
Header = p.Header,
Text = p.Text,
DateCreated = p.DateCreated,
Thumbnail = p.Thumbnail,
public IActionResult Main(Game game, string next)
{
string Name = "The Chief";
var messageList = new Dictionary<int, string>();
messageList.Add(1, "TEXT1");
messageList.Add(2, "TEXT2");
messageList.Add(3, "TEXT3");
var getChar = _context.GetCharacter(Name);
Expected:
Image1.jpg
Image2.jpg
Actual:
Image1.jpg
[Id] INT NOT NULL,
[Name] VARCHAR (50) NOT NULL,
[Description] VARCHAR (50) NOT NULL,
PRIMARY KEY CLUSTERED ([Id] ASC)