Exemplo n.º 1
0
        public IHttpActionResult PostReceiptPlanLines(ReceiptPlanLines receiptPlanLines)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            receiptPlanLines.ReceiptPlanLineNo = setMaxReceiptPlanLineNo(receiptPlanLines.ReceiptPlanId);

            db.ReceiptPlanLines.Add(receiptPlanLines);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (ReceiptPlanLinesExists(receiptPlanLines.ReceiptPlanId, receiptPlanLines.ReceiptPlanLineNo))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = receiptPlanLines.ReceiptPlanId }, receiptPlanLines));
        }
Exemplo n.º 2
0
        public IHttpActionResult GetReceiptPlanLines(int receiptPlanId, int receiptPlanLineNo)
        {
            ReceiptPlanLines receiptPlanLines = db.ReceiptPlanLines.Find(receiptPlanId, receiptPlanLineNo);

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

            return(Ok(receiptPlanLines));
        }
Exemplo n.º 3
0
        public IHttpActionResult DeleteReceiptPlanLines(int receiptPlanId, int receiptPlanLineNo)
        {
            ReceiptPlanLines receiptPlanLines = db.ReceiptPlanLines.Find(receiptPlanId, receiptPlanLineNo);

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

            db.ReceiptPlanLines.Remove(receiptPlanLines);
            db.SaveChanges();

            return(Ok(receiptPlanLines));
        }
Exemplo n.º 4
0
        // GET: ReceiptPlanLines/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ReceiptPlanLines receiptPlanLines = db.ReceiptPlanLines.Find(id);

            if (receiptPlanLines == null)
            {
                return(HttpNotFound());
            }
            return(View(receiptPlanLines));
        }
Exemplo n.º 5
0
        public IHttpActionResult PutReceiptPlanLines(ReceiptPlanLines receiptPlanLines)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }
            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 6
0
        // GET: ReceiptPlanLines/Delete/5
        public async System.Threading.Tasks.Task <ActionResult> Delete(int?receiptPlanId, int?receiptPlanLineNo)
        {
            if (receiptPlanId == null || receiptPlanLineNo == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Dictionary <string, string> paramList = new Dictionary <string, string>();

            paramList.Add("ReceiptPlanId", receiptPlanId.ToString());
            paramList.Add("ReceiptPlanLineNo", receiptPlanLineNo.ToString());

            ReceiptPlanLines receiptPlanLines = await new HttpClientLib().GetByAsync <ReceiptPlanLines>("API", "/api/ReceiptPlanLines/", paramList);

            if (receiptPlanLines == null)
            {
                return(HttpNotFound());
            }
            return(View(receiptPlanLines));
        }
Exemplo n.º 7
0
 public async System.Threading.Tasks.Task <ActionResult> Create2([Bind(Include = "ReceiptPlanId,ReceiptPlanLineNo,PurchaseOrderId,PurchaseOrderLineNo,ExpectedQty,RecivedQty,EntryAuthor,EntryDate,LastAuthor,LastUpdate")] ReceiptPlanLines receiptPlanLines)
 {
     new ObjectLib().InitObjec(receiptPlanLines, Request.RequestContext.HttpContext.User.Identity.Name);
     await new HttpClientLib().PostAsync("API", "/api/ReceiptPlanLines/", receiptPlanLines);
     return(RedirectToAction("Edit", "ReceiptPlans", new { id = receiptPlanLines.ReceiptPlanId }));
 }