You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.6 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BWPMModels;
using BlazorApp.Helper;
using Newtonsoft.Json;
namespace BlazorApp.Controller
{
public class BerufController
{
public static List<Beruf> GetAllData()
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("Beruf", "", "GET", null);
return JsonConvert.DeserializeObject<List<Beruf>>(httpcli.Results.daten);
}
public static void savedata(Beruf Berufdata)
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("Beruf", Berufdata.ID.ToString(), "PUT", Berufdata);
}
public static int InsertData(Beruf Berufdata)
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
httpcli.CallService("Beruf", "", "POST", Berufdata);
List<BWPMModels.Beruf> LastBeruf = new List<Beruf>();
LastBeruf = GetLast(Berufdata);
return LastBeruf.First<Beruf>().ID;
}
public static List<Beruf> GetLast(Beruf Berufdata)
{
Helper.HttpClientHelper httpcli = new Helper.HttpClientHelper();
string sql = "Select top 1 * from Beruf where mutierer='" + Berufdata.mutierer + "' order by erstellt_am desc";
httpcli.CallService("Beruf", "usersql/" + sql, "GET", Berufdata);
return JsonConvert.DeserializeObject<List<Beruf>>(httpcli.Results.daten);
}
}
}