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)); }
public IHttpActionResult GetReceiptPlanLines(int receiptPlanId, int receiptPlanLineNo) { ReceiptPlanLines receiptPlanLines = db.ReceiptPlanLines.Find(receiptPlanId, receiptPlanLineNo); if (receiptPlanLines == null) { return(NotFound()); } return(Ok(receiptPlanLines)); }
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)); }
// 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)); }
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)); }
// 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)); }
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 })); }