コード例 #1
0
 public ActionResult Edit(ProductVM prod)
 {
     try
     {
         // TODO: Add update logic here
         crudFactory.UpdateProduct(prod);
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }
コード例 #2
0
 //[ValidateAntiForgeryToken]
 public JsonResult Edit([FromBody] ProductVM prod)
 {
     try
     {
         if (prod != null)
         {
             crudFactory.UpdateProduct(prod);
             return(Json(prod));
         }
         else
         {
             return(Json(new ProductVM()));
         }
         // TODO: Add update logic here
     }
     catch (Exception ex)
     {
         return(Json(ex.Message));
     }
 }