Created
June 28, 2016 19:52
-
-
Save squadwuschel/010b5ae41f9fe468a139c2323fa1c7ea to your computer and use it in GitHub Desktop.
.NET Controller für AngularJs Proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ProxyController : Controller | |
{ | |
[CreateAngularTsProxy(ReturnType = typeof(Auto))] | |
public JsonResult AddTsEntryAndName(Person person, string name) | |
{ | |
return Json(new Auto() { Marke = name}, JsonRequestBehavior.AllowGet); | |
} | |
[CreateAngularTsProxy(ReturnType = typeof(Person))] | |
public JsonResult LoadTsCallById(int id) | |
{ | |
return Json(new Person() { Id = id}, JsonRequestBehavior.AllowGet); | |
} | |
[CreateAngularTsProxy(ReturnType = typeof(Person))] | |
public JsonResult LoadTsCallByParams(string name, string vorname, int alter) | |
{ | |
return Json(new Person() { Name = name, Id = alter}, JsonRequestBehavior.AllowGet); | |
} | |
[CreateAngularTsProxy(ReturnType = typeof(void))] | |
public JsonResult VoidTsReturnType(string name) | |
{ | |
return Json(string.Empty, JsonRequestBehavior.AllowGet); | |
} | |
[CreateAngularTsProxy(ReturnType = typeof(string))] | |
public JsonResult StringTsReturnType(string name) | |
{ | |
return Json(name, JsonRequestBehavior.AllowGet); | |
} | |
[CreateAngularTsProxy(ReturnType = typeof(int))] | |
public JsonResult IntegerTsReturnType(int age) | |
{ | |
return Json(age, JsonRequestBehavior.AllowGet); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment