コード例 #1
0
        public IHttpActionResult PostProofPayment(ProofPayment proofPayment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ProofPayment.Add(proofPayment);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (ProofPaymentExists(proofPayment.proofPayment1))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = proofPayment.proofPayment1 }, proofPayment));
        }
コード例 #2
0
        public IHttpActionResult PutProofPayment(string id, ProofPayment proofPayment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != proofPayment.proofPayment1)
            {
                return(BadRequest());
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProofPaymentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #3
0
        public IHttpActionResult GetProofPayment(string id)
        {
            ProofPayment proofPayment = db.ProofPayment.Find(id);

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

            return(Ok(proofPayment));
        }
コード例 #4
0
        public IHttpActionResult DeleteProofPayment(string id)
        {
            ProofPayment proofPayment = db.ProofPayment.Find(id);

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

            db.ProofPayment.Remove(proofPayment);
            db.SaveChanges();

            return(Ok(proofPayment));
        }
コード例 #5
0
        public async Task <IActionResult> edituploadAsync(OrderPrint orderPrint, ProofPayment proofPayment)
        {
            var searchData = _graphiczoneDBContext.OrderPrint.Where(x => x.OrPrintId == orderPrint.OrPrintId).FirstOrDefault();

            if (searchData != null)
            {
                var searchData2 = _graphiczoneDBContext.ProofPayment.Where(x => x.OrPrintId == proofPayment.OrPrintId).FirstOrDefault();
                if (searchData2 != null)
                {
                    _graphiczoneDBContext.Remove(searchData2);
                }

                searchData.OrPrintStatus = orderPrint.OrPrintStatus;

                proofPayment.OrPrintId  = orderPrint.OrPrintId;
                proofPayment.PrfPayDate = proofPayment.PrfPayDate;

                string wwwRootPath = _webHostEnvironment.WebRootPath;

                string fileName  = Path.GetFileNameWithoutExtension(Uploadfile.FileName);
                string extension = Path.GetExtension(Uploadfile.FileName);

                if (extension == ".jpg" || extension == ".png" || extension == ".gif")
                {
                    fileName = fileName + DateTime.Now.ToString("yymmssfff") + extension;
                    proofPayment.PrfPayFile = "images/" + fileName;
                    fileName = Path.Combine(wwwRootPath, "images", fileName);


                    using (var fileStream = new FileStream(fileName, FileMode.Create))
                    {
                        await Uploadfile.CopyToAsync(fileStream);
                    }
                }
                _graphiczoneDBContext.ProofPayment.Add(proofPayment);
                _graphiczoneDBContext.SaveChanges();
                var x = "คุณได้ทำการแจ้งหลักฐานการโอน รายการที่ : " + orderPrint.OrPrintId + "เรียบร้อยแล้ว";
                return(RedirectToAction("ListProofPayment"));
            }

            return(Json("ไม่สำเร็จ"));
        }
コード例 #6
0
 public IEnumerable <ProofPaymentdt> GetComprobantedePago()
 {
     return(ProofPayment.ComprobantedePago());
 }