예제 #1
0
        // GET: Models/Edit/5
        public ActionResult Edit(int id)
        {
            Model model = Repositry.Get(id);

            ViewBag.CategoryId = new SelectList(CategoryRepo.GetAll(), "Id", "Name");
            return(PartialView("Edit", model));
        }
예제 #2
0
 public ActionResult Delete(int id)
 {
     try
     {
         Model model = Repositry.Get(id);
         if (model == null)
         {
             return(NotFound("The Model is not found"));
         }
         this.Repositry.Delete(model);
         this.Repositry.SaveAll();
         return(Ok("The Model has been deleted"));
     }
     catch
     {
         return(BadRequest("An Error Has Occurred."));
     }
 }