Пример #1
0
 public ActionResult Edit(int id, Product product)
 {
     if (ModelState.IsValid)
     {
         productRepo.Update(id, product);
         return(RedirectToAction("Index"));
     }
     return(View(product));
 }
Пример #2
0
 public ActionResult Edit(int id, Trainer train)
 {
     if (ModelState.IsValid)
     {
         trainRepo.Update(id, train);
         return(RedirectToAction("Index"));
     }
     return(View(train));
 }
Пример #3
0
 public ActionResult Edit(int id, Course data)
 {
     if (ModelState.IsValid)
     {
         corRepository.Update(id, data);
         return(RedirectToAction("Index"));
     }
     return(View(data));
 }
 public ActionResult Edit(int id, StudentInfo data)
 {
     if (ModelState.IsValid)
     {
         catRepository.Update(id, data);
         return(RedirectToAction("Index"));
     }
     return(View(data));
 }
Пример #5
0
 public ActionResult Edit(int id, Student stud)
 {
     if (ModelState.IsValid)
     {
         studentRepo.Update(id, stud);
         return(RedirectToAction("Index"));
     }
     return(View(stud));
 }
 public ActionResult Edit(int id, Product data)
 {
     if (ModelState.IsValid)
     {
         prdRespository.Update(id, data);
         return(RedirectToAction("Index"));
     }
     return(View(data));
 }
Пример #7
0
 public ActionResult Edit(int id, Category data)
 {
     if (ModelState.IsValid)
     {
         catRepo.Update(id, data);
         return(RedirectToAction("Index"));
     }
     return(View(data));
 }
Пример #8
0
 public ActionResult Edit(int id, Course cor)
 {
     if (ModelState.IsValid)
     {
         corRepo.Update(id, cor);
         return(RedirectToAction("Index"));
     }
     return(View(cor));
 }
 /// <summary>
 /// http://localhost:<PORT>/api/CategoryAPI/{id}
 /// </summary>
 /// <returns></returns>
 public IHttpActionResult Put(int id, Category data)
 {
     if (ModelState.IsValid)
     {
         var result = catRepository.Update(id, data);
         return(Ok(data));
     }
     // if the Model is invalid the return vaidation error messages
     return(BadRequest(ModelState));
 }
 public ActionResult Edit(int id, Category data)
 {
     if (ModelState.IsValid)
     {
         if (data.BasePrice < 0)
         {
             throw new Exception("Base Price Cannot be -ve");
         }
         catRepository.Update(id, data);
         return(RedirectToAction("Index"));
     }
     return(View(data));
 }