aspnetcore/test/WebSites/FormatterWebSite/Controllers/HomeController.cs

38 lines
1.0 KiB
C#

// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Mvc;
namespace FormatterWebSite.Controllers
{
public class HomeController : Controller
{
[HttpPost]
public IActionResult Index([FromBody]DummyClass dummyObject)
{
return Content(dummyObject.SampleInt.ToString());
}
[HttpPost]
public DummyClass GetDummyClass(int sampleInput)
{
return new DummyClass { SampleInt = sampleInput };
}
[HttpPost]
public bool CheckIfDummyIsNull([FromBody] DummyClass dummy)
{
return dummy != null;
}
[HttpPost]
public DummyClass GetDerivedDummyClass(int sampleInput)
{
return new DerivedDummyClass
{
SampleInt = sampleInput,
SampleIntInDerived = 50
};
}
}
}