Beispiel #1
0
        public async Task <IHttpActionResult> PutGC_PagSeguroNotification(int id, GC_PagSeguroNotification gC_PagSeguroNotification)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != gC_PagSeguroNotification.Id)
            {
                return(BadRequest());
            }

            db.Entry(gC_PagSeguroNotification).State = EntityState.Modified;

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #2
0
        public async Task <IHttpActionResult> GetGC_PagSeguroNotification(int id)
        {
            GC_PagSeguroNotification gC_PagSeguroNotification = await db.GC_PagSeguroNotification.FindAsync(id);

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

            return(Ok(gC_PagSeguroNotification));
        }
Beispiel #3
0
        public async Task <IHttpActionResult> PostGC_PagSeguroNotification(GC_PagSeguroNotification gC_PagSeguroNotification)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.GC_PagSeguroNotification.Add(gC_PagSeguroNotification);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = gC_PagSeguroNotification.Id }, gC_PagSeguroNotification));
        }
Beispiel #4
0
        public async Task <IHttpActionResult> DeleteGC_PagSeguroNotification(int id)
        {
            GC_PagSeguroNotification gC_PagSeguroNotification = await db.GC_PagSeguroNotification.FindAsync(id);

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

            db.GC_PagSeguroNotification.Remove(gC_PagSeguroNotification);
            await db.SaveChangesAsync();

            return(Ok(gC_PagSeguroNotification));
        }
Beispiel #5
0
        public Boolean Post([FromUri] object instituicao)
        {
            var code = HttpContext.Current.Request.Params["notificationCode"];
            var type = HttpContext.Current.Request.Params["notificationType"];

            if (String.Equals("transaction", type))
            {
                GC_PagSeguroNotification oGC_PagSeguroNotification = new GC_PagSeguroNotification();
                oGC_PagSeguroNotification.Address     = "PORT_1";
                oGC_PagSeguroNotification.Code        = code;
                oGC_PagSeguroNotification.IsProcessed = false;
                db.GC_PagSeguroNotification.Add(oGC_PagSeguroNotification);
                Int32 id = db.SaveChanges();
                //oGC_PagSeguroNotification.Id =
                new Pagseguro().ProcessNotification(code, "PORT_1");

                oGC_PagSeguroNotification.IsProcessed = true;
                db.SaveChanges();

                return(true);
            }
            return(false);
        }