Esempio n. 1
0
 public ActionResult Delete(int id)
 {
     if (dao.Delete(id))
     {
         SetAlert("Product deleted", "success");
         return(RedirectToAction("Index"));
     }
     else
     {
         SetAlert("Delete failed", "error");
     }
     return(RedirectToAction("Index"));
 }
Esempio n. 2
0
        public JsonResult Delete(long id)
        {
            var  dao    = new ProductsDao();
            bool result = dao.Delete(id);

            try
            {
                return(Json(new
                {
                    status = result
                }));
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    status = result,
                    message = ex.Message
                }));
            }
        }