Skip to content

Commit

Permalink
Fixed vip carica link live
Browse files Browse the repository at this point in the history
  • Loading branch information
Murkrow02 committed Nov 23, 2020
1 parent 70965c2 commit 6724f46
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 4 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file modified SalveminiApiCore/.DS_Store
Binary file not shown.
Binary file modified SalveminiApiCore/SalveminiApi core/.DS_Store
Binary file not shown.
Binary file modified SalveminiApiCore/SalveminiApi core/SalveminiApi core/.DS_Store
Binary file not shown.
8 changes: 7 additions & 1 deletion SalveminiNetStandard/SalveminiApp/AreaVip/NewLive.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ async void Button_Clicked(System.Object sender, System.EventArgs e)
return;
}

var success = await App.Index.PostLiveLink(liveLink.Text);
if(string.IsNullOrEmpty(liveName.Text) || liveName.Text.Length > 49)
{
await DisplayAlert("Errore", "Inserisci un titolo valido", "Ok");
return;
}

var success = await App.Index.PostLiveLink(new RestApi.Models.LiveLink { Link = liveLink.Text, Title = liveName.Text });

if (!success)
{
Expand Down
14 changes: 14 additions & 0 deletions SalveminiNetStandard/SalveminiApp/RestApi/Models/LiveLink.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;

using Xamarin.Forms;

namespace SalveminiApp.RestApi.Models
{
public class LiveLink
{
public string Link { get; set; }
public DateTime CreatedOn { get; set; }
public string Title { get; set; }
}
}

7 changes: 4 additions & 3 deletions SalveminiNetStandard/SalveminiApp/RestApi/RestServiceIndex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Reflection;
using System.Linq;
using MonkeyCache.SQLite;
using SalveminiApp.RestApi.Models;

namespace SalveminiApp.RestApi
{
Expand Down Expand Up @@ -129,7 +130,7 @@ public RestServiceIndex()
return IndexArgo;
}

public async Task<bool> PostLiveLink(string link)
public async Task<bool> PostLiveLink(LiveLink link)
{
var uri = Costants.Uri("live");

Expand Down Expand Up @@ -162,7 +163,7 @@ public interface IRestServiceIndex
Task<Models.Index> GetIndex();
Task<Models.IndexArgo> GetIndexArgo();
Task<List<Models.Giornalino>> GetGiornalini();
Task<bool> PostLiveLink(string link);
Task<bool> PostLiveLink(LiveLink link);

}

Expand Down Expand Up @@ -192,7 +193,7 @@ public ItemManagerIndex(IRestServiceIndex serviceIndex)
return restServiceIndex.GetIndexArgo();
}

public Task<bool> PostLiveLink(string link)
public Task<bool> PostLiveLink(LiveLink link)
{
return restServiceIndex.PostLiveLink(link);
}
Expand Down

0 comments on commit 6724f46

Please sign in to comment.