コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Vojvoda vojvoda = vojvodaRepository.GetVojvodaByID(id);

            vojvodaRepository.DeleteVojvoda(id);
            vojvodaRepository.Save();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "VojvodaID,Name,DateOfBirth")] Vojvoda vojvoda)
 {
     if (ModelState.IsValid)
     {
         vojvodaRepository.UpdateVojvoda(vojvoda);
         vojvodaRepository.Save();
         return(RedirectToAction("Index"));
     }
     return(View(vojvoda));
 }
コード例 #3
0
        // GET: Vojvodas/Edit/5
        public ActionResult Edit(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Vojvoda vojvoda = vojvodaRepository.GetVojvodaByID(id);

            if (vojvoda == null)
            {
                return(HttpNotFound());
            }
            return(View(vojvoda));
        }
コード例 #4
0
 public void UpdateVojvoda(Vojvoda vojvoda)
 {
     db.Entry(vojvoda).State = EntityState.Modified;
 }
コード例 #5
0
        public void DeleteVojvoda(int VojvodaID)
        {
            Vojvoda vojvoda = db.Vojvodas.Find(VojvodaID);

            db.Vojvodas.Remove(vojvoda);
        }
コード例 #6
0
 public void InsertVojvoda(Vojvoda vojvoda)
 {
     db.Vojvodas.Add(vojvoda);
 }