コード例 #1
0
        public async Task <ActionResult> DeleteConfirmed(decimal id)
        {
            DEPARTEMENT dEPARTEMENT = await db.DEPARTEMENTs.FindAsync(id);

            db.DEPARTEMENTs.Remove(dEPARTEMENT);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public async Task <ActionResult> Edit([Bind(Include = "ID_DEPARTEMENT,NOM_DEPARTEMENT")] DEPARTEMENT dEPARTEMENT)
        {
            if (ModelState.IsValid)
            {
                db.Entry(dEPARTEMENT).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(dEPARTEMENT));
        }
コード例 #3
0
        public async Task <ActionResult> Create([Bind(Include = "ID_DEPARTEMENT,NOM_DEPARTEMENT")] DEPARTEMENT dEPARTEMENT)
        {
            if (ModelState.IsValid)
            {
                db.DEPARTEMENTs.Add(dEPARTEMENT);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(dEPARTEMENT));
        }
コード例 #4
0
        // GET: DEPARTEMENTs/Delete/5
        public async Task <ActionResult> Delete(decimal id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DEPARTEMENT dEPARTEMENT = await db.DEPARTEMENTs.FindAsync(id);

            if (dEPARTEMENT == null)
            {
                return(HttpNotFound());
            }
            return(View(dEPARTEMENT));
        }