Esempio n. 1
0
        /// <summary>
        /// This was created for use in the bulk process..
        ///
        /// </summary>
        /// <param name="p"></param>
        /// <param name="checkName">This will check the PaymentGatewayLogs by name to see if they exist already. If it does an error message will be returned.</param>
        /// <returns></returns>
        public ServiceResult Insert(PaymentGatewayLog p)
        {
            p.UUID = Guid.NewGuid().ToString("N");

            // if (!this.DataAccessAuthorized(p, "POST", false)) return ServiceResponse.Error("You are not authorized this action.");

            using (var context = new GreenWerxDbContext(_dbConnectionKey))
            {
                if (context.Insert <PaymentGatewayLog>(p))
                {
                    return(ServiceResponse.OK("", p));
                }
            }
            return(ServiceResponse.Error("An error occurred inserting PaymentGatewayLog " + p.Gateway));
        }
Esempio n. 2
0
        public ServiceResult Update(PaymentGatewayLog p)
        {
            // if (!this.DataAccessAuthorized(p, "PATCH", false)) return ServiceResponse.Error("You are not authorized this action.");

            ServiceResult res = ServiceResponse.OK();

            using (var context = new GreenWerxDbContext(_dbConnectionKey))
            {
                if (context.Update <PaymentGatewayLog>(p) == 0)
                {
                    return(ServiceResponse.Error(p.Gateway + " failed to update. "));
                }
            }
            return(res);
        }