-
Notifications
You must be signed in to change notification settings - Fork 1
/
HomeController.cs
67 lines (58 loc) · 1.94 KB
/
HomeController.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
66
67
using ActionResultTypes.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;
using Newtonsoft.Json;
using System.Diagnostics;
namespace ActionResultTypes.Controllers
{
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
public HomeController(ILogger<HomeController> logger)
{
_logger = logger;
}
public IActionResult Index()
{
return View();
}
public ViewResult ShowEmployee()
{
EmployeeModel employee = new EmployeeModel()
{
EmployeeID = 1,
FirstName = "Paul",
LastName = "Andrew",
Location = "Mumbai",
Email = "Paul@geeksarray.com"
};
return View(employee);
}
public ContentResult ContentResultTest()
{
return Content("<b>Hello from GeeksArray</b>", "text/html", System.Text.Encoding.UTF8);
}
public RedirectResult RedirectResultTest()
{
//return Redirect("https://geeksarray.com");
//return RedirectPermanent("https://google.com");
//return RedirectPreserveMethod("https://geeksarray.com");
return RedirectPermanentPreserveMethod("https://geeksarray.com");
}
public FileResult FileResultTest()
{
return File("~/downloads/pdf-sample.pdf", "application/pdf");
}
public StatusCodeResult StatusCodeResultTest()
{
return StatusCode(200);
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}