示例#1
0
        public ListPursesResponse GetPursesByCurrency(GetPursesByCurrencyRequest request)
        {
            return(GetResponse(() => {
                var response = new ListPursesResponse();
                try
                {
                    using (FamilyFinanceContext db = new FamilyFinanceContext())
                    {
                        if (request.PersonId == null && request.FamilyId == null)
                        {
                            response.BaseIsSuccess = false;
                            response.BaseMessage = Shared.Constants.NEED_AUTHORIZE;
                        }
                        else
                        {
                            response.Purses = db.Purses.Where(x => (x.FamilyId == request.FamilyId && x.PersonId == request.PersonId && x.CurrencyId == request.CurrencyId) ||
                                                              (x.FamilyId == request.FamilyId && x.CurrencyId == request.CurrencyId && x.PersonId == null)).ToList();
                        }
                    }
                }
                catch
                {
                    response.BaseIsSuccess = false;
                    response.BaseMessage = Shared.Constants.BAD_REQUEST;
                }

                return response;
            }));
        }
示例#2
0
 public ListPursesResponse GetPursesByCurrency([FromBody] GetPursesByCurrencyRequest request) =>
 _purseService.GetPursesByCurrency(request);
示例#3
0
 public async Task <ListPursesResponse> GetPursesByCurrencyAsync(GetPursesByCurrencyRequest request) =>
 await TryCallApiAsync <ListPursesResponse>("purses/get_purses_by_currency", request);