Initial commit
This commit is contained in:
23
App/Controllers/FormController.cs
Normal file
23
App/Controllers/FormController.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace sf1.Controllers
|
||||
{
|
||||
public class FormController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
|
||||
}
|
||||
|
||||
public IActionResult Save(string firstname, string lastname)
|
||||
{
|
||||
ViewBag.daten = firstname + lastname;
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
||||
37
App/Controllers/HomeController.cs
Normal file
37
App/Controllers/HomeController.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using sf1.Models;
|
||||
|
||||
namespace sf1.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
|
||||
public HomeController(ILogger<HomeController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult Privacy()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
}
|
||||
}
|
||||
113
App/Controllers/UserController.cs
Normal file
113
App/Controllers/UserController.cs
Normal file
@@ -0,0 +1,113 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http.Formatting;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Syncfusion.EJ2;
|
||||
using BWPMModels;
|
||||
using System.Collections;
|
||||
using Syncfusion.EJ2.Base;
|
||||
using sf1.Models;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using System.Reflection;
|
||||
|
||||
namespace sf1.Controllers
|
||||
{
|
||||
public partial class UserController : Controller
|
||||
{
|
||||
private const string URL = "http://localhost/CoreWebAPI1/api/";
|
||||
public IActionResult Index()
|
||||
{
|
||||
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult UrlDatasource([FromBody] DataManagerRequest dm)
|
||||
{
|
||||
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
|
||||
httpcli.CallService("user", "", "GET",null);
|
||||
if (httpcli.Results.resultstatus != true)
|
||||
{
|
||||
return View();
|
||||
|
||||
}
|
||||
List<User> users = JsonConvert.DeserializeObject<List<User>>(httpcli.Results.daten);
|
||||
|
||||
ViewBag.DataSource = users;
|
||||
IEnumerable DataSource = users;
|
||||
|
||||
|
||||
DataOperations operation = new DataOperations();
|
||||
if (dm.Search != null && dm.Search.Count > 0)
|
||||
{
|
||||
DataSource = operation.PerformSearching(DataSource, dm.Search); //Search
|
||||
}
|
||||
if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting
|
||||
{
|
||||
DataSource = operation.PerformSorting(DataSource, dm.Sorted);
|
||||
}
|
||||
if (dm.Where != null && dm.Where.Count > 0)
|
||||
{
|
||||
DataSource = operation.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator); //Filtering
|
||||
}
|
||||
int count = DataSource.Cast<User>().Count();
|
||||
if (dm.Skip != 0)
|
||||
{
|
||||
DataSource = operation.PerformSkip(DataSource, dm.Skip); //Paging
|
||||
}
|
||||
if (dm.Take != 0)
|
||||
{
|
||||
DataSource = operation.PerformTake(DataSource, dm.Take);
|
||||
}
|
||||
return dm.RequiresCounts ? Json(new { result = DataSource, count = count }) : Json(DataSource);
|
||||
}
|
||||
public ActionResult Update([FromBody] ICRUDModel<User> value)
|
||||
{
|
||||
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
|
||||
User u = new User();
|
||||
u = value.value;
|
||||
httpcli.CallService("user",u.ID.ToString(), "PUT", value.value);
|
||||
if (httpcli.Results.resultstatuscode !="OK")
|
||||
{
|
||||
return View();
|
||||
}
|
||||
return Json(value.value);
|
||||
}
|
||||
|
||||
public ActionResult Insert([FromBody] ICRUDModel<User> value)
|
||||
{
|
||||
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
|
||||
User u = new User();
|
||||
u = value.value;
|
||||
u.Teststring = "hallo";
|
||||
u.aktiv = true;
|
||||
httpcli.CallService("user", "", "POST", u);
|
||||
if (httpcli.Results.resultstatuscode != "OK")
|
||||
{
|
||||
return View();
|
||||
}
|
||||
return Json(value.value);
|
||||
}
|
||||
|
||||
public ActionResult Remove([FromBody] CRUDModel<User> value)
|
||||
{
|
||||
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
|
||||
|
||||
|
||||
httpcli.CallService("user", value.Key.ToString(), "DELETE", null);
|
||||
if (httpcli.Results.resultstatuscode != "OK")
|
||||
{
|
||||
return View();
|
||||
}
|
||||
return Json(value);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user