コード例 #1
0
        public async Task <IHttpActionResult> PutEntrySlip(int id, EntrySlip entrySlip)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            EntrySlip entrySlip = db.EntrySlips.Find(id);

            db.EntrySlips.Remove(entrySlip);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #3
0
 private void GetEntrySlipId()
 {
     if (Session["EntrySlipId"] == null)
     {
         EntrySlip entryslip = new EntrySlip();
         db.EntrySlips.Add(entryslip);
         db.SaveChanges();
         Session["EntrySlipId"] = entryslip.Id;
     }
 }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "Id,CreatedDate,Description,DeliveryMan,UserId,ESTypeId,PeriodId")] EntrySlip entrySlip)
 {
     if (ModelState.IsValid)
     {
         db.Entry(entrySlip).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PeriodId = new SelectList(db.Periods, "Id", "Name", entrySlip.PeriodId);
     return(View(entrySlip));
 }
コード例 #5
0
        public async Task <IHttpActionResult> GetEntrySlip(int id)
        {
            EntrySlip entrySlip = await db.EntrySlips.FindAsync(id);

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

            return(Ok(entrySlip));
        }
コード例 #6
0
        public async Task <IHttpActionResult> PostEntrySlip(EntrySlip entrySlip)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.EntrySlips.Add(entrySlip);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = entrySlip.Id }, entrySlip));
        }
コード例 #7
0
        // GET: EntrySlips/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EntrySlip entrySlip = db.EntrySlips.Find(id);

            if (entrySlip == null)
            {
                return(HttpNotFound());
            }
            return(View(entrySlip));
        }
コード例 #8
0
        public async Task <IHttpActionResult> DeleteEntrySlip(int id)
        {
            EntrySlip entrySlip = await db.EntrySlips.FindAsync(id);

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

            db.EntrySlips.Remove(entrySlip);
            await db.SaveChangesAsync();

            return(Ok(entrySlip));
        }
コード例 #9
0
        // GET: EntrySlips/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EntrySlip entrySlip = db.EntrySlips.Find(id);

            if (entrySlip == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PeriodId = new SelectList(db.Periods, "Id", "Name", entrySlip.PeriodId);
            ViewBag.ESTypeId = new SelectList(db.EntrySlipTypes, "Id", "Name", entrySlip.ESTypeId);
            return(View(entrySlip));
        }