示例#1
0
        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();
        }
示例#2
0
 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
     });
 }
示例#3
0
 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);
     }
 }
示例#4
0
 public bool AddAlmsgiving(AlmsgivingEntity alms)
 {
     return(_almsgivingService.AddAlms(alms));
 }