private async void SubmitBtn_OnClicked(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(Name.Text)) { NameError.IsVisible = true; return; } if (String.IsNullOrWhiteSpace(Description.Text)) { DescriptionError.IsVisible = true; return; } if (String.IsNullOrWhiteSpace(_photo64)) { PhotoError.IsVisible = true; return; } var alm = new AlmsgivingEntity { Type = _type, Name = Name.Text, Photo = _photo64, Description = Description.Text, BearerId = _bearerId, Nickname = _nickname, Phone = _phone }; await HttpService.Post <bool, AlmsgivingEntity>(alm, Links.AlmsLink + "add"); await Navigation.PopAsync(); }
public Almsgiving AlmEntityToAlms(AlmsgivingEntity alms, DateTime dateTime, string filepath) { return(new Almsgiving() { BearerId = alms.BearerId, Date = dateTime, Description = alms.Description, Name = alms.Name, Photo = filepath, Type = alms.Type }); }
public bool AddAlms(AlmsgivingEntity alms) { try { string filepath = @"D:\TPO3_Photos\" + Guid.NewGuid() + ".jpg"; File.WriteAllBytes(filepath, Convert.FromBase64String(alms.Photo)); Almsgiving alm = _mapper.AlmEntityToAlms(alms, DateTime.Today, filepath); _almsgivingRepository.AddAlmsgiving(alm); return(true); } catch (Exception) { return(false); } }
public bool AddAlmsgiving(AlmsgivingEntity alms) { return(_almsgivingService.AddAlms(alms)); }