예제 #1
0
        public PurchaseView GetAsset_master(int ordno)
        {
            db.Configuration.ProxyCreationEnabled = true;
            PurchaseTbl  x       = db.PurchaseTbls.Where(y => y.pd_order_no == ordno).FirstOrDefault();
            PurchaseView pvModel = new PurchaseView();

            if (x == null)
            {
            }

            else
            {
                pvModel.pd_id        = x.pd_id;
                pvModel.pd_order_no  = Convert.ToInt32(x.pd_order_no);
                pvModel.pd_ad_id     = x.assetDef.ad_id;
                pvModel.assetname    = x.assetDef.ad_name;
                pvModel.pd_datestr   = x.pd_datestr;
                pvModel.pd_ddatestr  = x.pd_ddatestr;
                pvModel.pd_qty       = Convert.ToInt32(x.pd_qty);
                pvModel.pd_status    = x.pd_status;
                pvModel.pd_atype_id  = x.assetType.at_id;
                pvModel.assettype    = x.assetType.at_name;
                pvModel.pd_vendor_id = x.pd_vendor_id;
                pvModel.vendorname   = x.vendorTbl.vd_name;
            }

            return(pvModel);
        }
 public IHttpActionResult PutPurchase_order(int id, PurchaseTbl purchase_order)
 {
     count = Convert.ToDecimal(purchase_order.pd_qty);
     db.Entry(purchase_order).State = EntityState.Modified;
     db.SaveChanges();
     return(StatusCode(HttpStatusCode.NoContent));
 }
        public IHttpActionResult PutPurchaseTbl(int id, PurchaseTbl purchaseTbl)
        {
            if (id != purchaseTbl.pd_id)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #4
0
        public IHttpActionResult PostPurchaseTbl(PurchaseTbl purchaseTbl)
        {
            db.PurchaseTbls.Add(purchaseTbl);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = purchaseTbl.pd_id }, purchaseTbl));
        }
        public IHttpActionResult DeletePurchaseTbl(int id)
        {
            PurchaseTbl purchaseTbl = db.PurchaseTbls.Find(id);

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

            db.PurchaseTbls.Remove(purchaseTbl);
            db.SaveChanges();

            return(Ok(purchaseTbl));
        }
예제 #6
0
        //// GET: api/PurchaseEdit/5
        //[ResponseType(typeof(PurchaseTbl))]
        //public IHttpActionResult GetPurchaseTbl(int id)
        //{
        //    PurchaseTbl purchaseTbl = db.PurchaseTbls.Find(id);
        //    if (purchaseTbl == null)
        //    {
        //        return NotFound();
        //    }

        //    return Ok(purchaseTbl);
        //}
        public PurchaseView GetPurchaseOrder(int id)
        {
            db.Configuration.ProxyCreationEnabled = true;
            PurchaseTbl  order = db.PurchaseTbls.Where(x => x.pd_id == id).FirstOrDefault();
            PurchaseView model = new PurchaseView();

            model.pd_id        = order.pd_id;
            model.pd_order_no  = Convert.ToInt32(order.pd_order_no);
            model.assetname    = order.assetDef.ad_name;
            model.assettype    = order.assetType.at_name;
            model.pd_ad_id     = order.pd_ad_id;
            model.pd_atype_id  = order.pd_atype_id;
            model.pd_vendor_id = order.pd_vendor_id;
            model.vendorname   = order.vendorTbl.vd_name;
            model.pd_datestr   = order.pd_datestr;
            model.pd_ddatestr  = order.pd_ddatestr;
            model.pd_qty       = Convert.ToInt32(order.pd_qty);
            model.pd_status    = order.pd_status;



            return(model);
        }