Gemeinde und Projekt als Pflichtfeld
This commit is contained in:
@@ -2,9 +2,10 @@
|
||||
using System.Text;
|
||||
using Jugenddienst_Stunden.Types;
|
||||
using System.Text.Json;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
|
||||
namespace Jugenddienst_Stunden.Models;
|
||||
namespace Jugenddienst_Stunden.Models;
|
||||
|
||||
class Auth {
|
||||
public static async Task<string> GetApiDataWithAuthAsync(string url, string token) {
|
||||
@@ -34,9 +35,25 @@ class Auth {
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Stundeneintrag speichern
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="isNewItem"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task SaveItemAsync(string url, string token, DayTime item, bool isNewItem = false) {
|
||||
//using (HttpClient client = new HttpClient() { Timeout = TimeSpan.FromSeconds(15) }) {
|
||||
|
||||
//Gemeinde ist ein Pflichtfeld
|
||||
if (item.GemeindeAktiv == null) {
|
||||
throw new Exception("Gemeinde nicht gewählt");
|
||||
}
|
||||
//Projekt ist ein Pflichtfeld
|
||||
if (item.ProjektAktiv == null) {
|
||||
throw new Exception("Projekt nicht gewählt");
|
||||
}
|
||||
try {
|
||||
HttpClient client = new HttpClient();
|
||||
client.DefaultRequestHeaders.Add("Accept", "application/json");
|
||||
|
||||
Reference in New Issue
Block a user