Ejemplo n.º 1
0
        public async Task <object> GetDonation()
        {
            try
            {
                var result = dataContext.Donations.Select(x => new Donation
                {
                    Annonymous  = x.Annonymous,
                    Amount      = x.Amount,
                    AccountType = x.AccountType,
                    CardNumber  = x.CardNumber,
                    CVV         = x.CVV,
                    Email       = x.Email,
                    ExpiryDate  = x.ExpiryDate,
                    Name        = x.Name,
                    Pin         = x.Pin
                });

                var donationList = new DonationListDTO
                {
                    Donation = result.ToList()
                };
                res.Data    = donationList;
                res.Message = "List of donation";
                res.Success = true;
                return(res);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        public async Task <object> GetDonationByUserEmail(string Email)
        {
            try
            {
                var result = dataContext.Donations.Where(x => x.Email == Email.ToString()).AsQueryable().Select(x => new Donation
                {
                    Annonymous  = x.Annonymous,
                    Amount      = x.Amount,
                    AccountType = x.AccountType,
                    CardNumber  = x.CardNumber,
                    CVV         = x.CVV,
                    Email       = x.Email,
                    ExpiryDate  = x.ExpiryDate,
                    Name        = x.Name,
                    Pin         = x.Pin
                });
                var list = new DonationListDTO
                {
                    Donation = result.ToList()
                };

                if (list == null)
                {
                    res.Data    = null;
                    res.Message = "No Donation made by this user was found";
                    res.Success = false;
                    return(res);
                }
                else
                {
                    res.Data    = list;
                    res.Message = "List of Donations made by this user returned";
                    res.Success = true;
                    return(res);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }