Пример #1
0
        public async Task <int> ManageAdminFoundAlertsAsync(AdminManageFoundAlertRequest request)
        {
            int records;
            PetAlertTableModel petAlert = null;

            using (var dbConnection = _dbConnectionFactory.Open())
            {
                using (var trans = dbConnection.OpenTransaction())
                {
                    if (request.Id.HasValue)
                    {
                        petAlert = await dbConnection.SingleByIdAsync <PetAlertTableModel>(request.Id.Value)
                                   .ConfigureAwait(false);
                    }
                    else if (request.Code.HasValue)
                    {
                        petAlert = await dbConnection.SingleAsync <PetAlertTableModel>(p => p.Code == request.Code.Value)
                                   .ConfigureAwait(false);
                    }

                    var action = request.Action;

                    records = await dbConnection.UpdateOnlyAsync(new PetAlertTableModel { Approved = action }, x => x.Approved, x => x.Id == petAlert.Id)
                              .ConfigureAwait(false);

                    trans.Commit();
                }
            }

            return(records);
        }
Пример #2
0
        public int ManageComent(string code, int action)
        {
            var request = new AdminManageFoundAlertRequest {
                Code = Guid.Parse(code), Action = action
            };

            return(_adminServiceClient.ManageComent(request));
        }
Пример #3
0
        public async Task <int> Post(AdminManageFoundAlertRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            return(await _adminProvider.ManageAdminFoundAlertsAsync(request)
                   .ConfigureAwait(false));
        }
Пример #4
0
        public async Task <int> ManageAdminFoundAlertsAsync(AdminManageFoundAlertRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            if (request.Id.HasValue && !request.Code.HasValue)
            {
                throw new ArgumentException("Id and Code are NULL");
            }

            return(await _adminDataAccess.ManageAdminFoundAlertsAsync(request)
                   .ConfigureAwait(false));
        }
Пример #5
0
 public int ManageComent(AdminManageFoundAlertRequest request)
 {
     return(_findMyPetClient.JsonClient().Post(request));
 }