Exemple #1
0
        public ActionResult CreateEdit(PelangganViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (PelangganDataAccess.Update(model))
                    {
                        return(Json(new { success = true, message = "Succes" }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json(new { success = false, message = PelangganDataAccess.Message }, JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    return(Json(new { success = false, message = "Pelase full fill required fields" }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, message = ex.Message }, JsonRequestBehavior.AllowGet));

                {
                }
            }
        }
Exemple #2
0
 public ActionResult DeleteConfirm(int id)
 {
     if (PelangganDataAccess.Delete(id))
     {
         return(Json(new { success = true, message = "Success" }, JsonRequestBehavior.AllowGet));
     }
     else
     {
         return(Json(new { success = false, message = "Error" }, JsonRequestBehavior.AllowGet));
     }
 }
Exemple #3
0
 public ActionResult Delete(int id)
 {
     return(View(PelangganDataAccess.GetById(id)));
 }
Exemple #4
0
 public ActionResult List()
 {
     return(View(PelangganDataAccess.GetAll()));
 }