Skip to content

Instantly share code, notes, and snippets.

Dhananjay Kumar debugmodedotnet

Block or report user

Report or block debugmodedotnet

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View typeofactiontype10.cs
public IEnumerable<Training> GetAllTrainings()
{
return trainings;
}
View typeofactiontype8.cs
[Route("Data")]
[HttpGet]
public IHttpActionResult GetData()
{
var data = GetAllTrainings();
return new TrainingDataResponse(data.ToList(), Request);
}
View typeofactiontype7.cs
public class TrainingDataResponse : IHttpActionResult
{
List<Training> _data;
HttpRequestMessage _request;
public TrainingDataResponse(List<Training> data, HttpRequestMessage request)
{
_data = data;
_request = request;
View typeofactiontype5.cs
[Route("gettrainings/{id:int}")]
[HttpGet]
public IHttpActionResult GetTraining(int id)
{
var training = trainings.FirstOrDefault((t) => t.Id == id);
if(training == null)
{
return NotFound();
}
View typeofactiontype3.cs
[Route("Data")]
[HttpGet]
public HttpResponseMessage GetData()
{
var data = GetAllTrainings();
HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, data);
response.Headers.CacheControl = new CacheControlHeaderValue()
{
MaxAge = TimeSpan.FromMinutes(20)
View typeofactiontype2.cs
[Route("Data")]
[HttpGet]
public HttpResponseMessage GetData()
{
HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);
response.Content = new StringContent("hello geek97", Encoding.Unicode);
response.ReasonPhrase = "Data is processed";
response.Headers.CacheControl = new CacheControlHeaderValue()
{
MaxAge = TimeSpan.FromMinutes(20)
View typeofactiontype1.cs
[Route("Log")]
[HttpPost]
public void LogSomething()
{
// do some logging
}
View typeofactiontype1.cs
[Route("Log")]
[HttpPost]
public void LogSomething()
{
// do some logging
}
View ComponentCommunicationAppcomponent.js
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
products = [];
@debugmodedotnet
debugmodedotnet / fourwaysofcreatingobjectinjs.js
Created Aug 1, 2019
Code shows four ways of creating an object in JavaScript
View fourwaysofcreatingobjectinjs.js
// Fours ways of creating an object in JavaScript
// 1. object as a literal
var car = {
model: 'bmw',
color: 'red',
price: 2000,
You can’t perform that action at this time.