Пример #1
0
        // POST: odata/OnlinePaymentDetails
        public async Task <IHttpActionResult> Post(OnlinePaymentDetail onlinePaymentDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.OnlinePaymentDetails.Add(onlinePaymentDetail);
            await db.SaveChangesAsync();

            return(Created(onlinePaymentDetail));
        }
Пример #2
0
        // DELETE: odata/OnlinePaymentDetails(5)
        public async Task <IHttpActionResult> Delete([FromODataUri] int key)
        {
            OnlinePaymentDetail onlinePaymentDetail = await db.OnlinePaymentDetails.FindAsync(key);

            if (onlinePaymentDetail == null)
            {
                return(NotFound());
            }

            db.OnlinePaymentDetails.Remove(onlinePaymentDetail);
            await db.SaveChangesAsync();

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #3
0
        // PUT: odata/OnlinePaymentDetails(5)
        public async Task <IHttpActionResult> Put([FromODataUri] int key, Delta <OnlinePaymentDetail> patch)
        {
            Validate(patch.GetEntity());

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            OnlinePaymentDetail onlinePaymentDetail = await db.OnlinePaymentDetails.FindAsync(key);

            if (onlinePaymentDetail == null)
            {
                return(NotFound());
            }

            patch.Put(onlinePaymentDetail);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!OnlinePaymentDetailExists(key))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Updated(onlinePaymentDetail));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                EphraimTradersEntities         db = new EphraimTradersEntities();
                ept.Models.OnlinePaymentDetail objOnlinePaymentDetails = new OnlinePaymentDetail();
                if (Request["amount"] != null)
                {
                    objOnlinePaymentDetails.amount = Convert.ToDecimal(Request["amount"]);
                }
                if (Request["buyer"] != null)
                {
                    objOnlinePaymentDetails.email = Request["buyer"].ToString();
                }
                if (Request["buyer_name"] != null)
                {
                    objOnlinePaymentDetails.name = Request["buyer_name"].ToString();
                }
                if (Request["buyer_phone"] != null)
                {
                    objOnlinePaymentDetails.phone = Request["buyer_phone"].ToString();
                }
                if (Request["currency"] != null)
                {
                    objOnlinePaymentDetails.currency = Request["currency"].ToString();
                }
                if (Request["fees"] != null)
                {
                    objOnlinePaymentDetails.Fees = Convert.ToDecimal(Request["fees"]);
                }
                if (Request["mac"] != null)
                {
                    objOnlinePaymentDetails.MAC = Request["mac"].ToString();
                }
                if (Request["longurl"] != null)
                {
                    objOnlinePaymentDetails.LongUrl = Request["longurl"].ToString();
                }
                if (Request["payment_id"] != null)
                {
                    objOnlinePaymentDetails.InstamojoPaymentId = Request["payment_id"].ToString();
                }
                if (Request["payment_request_id"] != null)
                {
                    objOnlinePaymentDetails.RequestId = Request["payment_request_id"].ToString();
                }
                if (Request["purpose"] != null)
                {
                    objOnlinePaymentDetails.description = Request["purpose"].ToString();
                }
                if (Request["shorturl"] != null)
                {
                    objOnlinePaymentDetails.ShortUrl = Request["shorturl"].ToString();
                }
                if (Request["status"] != null)
                {
                    objOnlinePaymentDetails.Status = Request["status"].ToString();
                }

                objOnlinePaymentDetails.CreatedBy = Request["buyer"].ToString();
                objOnlinePaymentDetails.CreatedOn = DateTime.Now;

                db.OnlinePaymentDetails.Add(objOnlinePaymentDetails);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                writelog(ex.Message);
            }
        }