Exemple #1
0
        // GET: Mahasiswa
        public ActionResult Index()
        {
            Mahasiswa = new MahasiswaService();
            var result = Mahasiswa.GetListMahasiswa();

            return(View(result));
        }
 void LoadData()
 {
     if (!IsPostBack)
     {
         using (MahasiswaService svc = new MahasiswaService())
         {
             var datas = svc.GetAll();
             Grid1.DataSource = datas;
             Grid1.DataBind();
         }
     }
 }
Exemple #3
0
        public ActionResult Edit(MahasiswaModel model)
        {
            try
            {
                Mahasiswa = new MahasiswaService();

                Mahasiswa.UpdateMahasiswa(model);
                return(Json(new { success = true, message = "Data Update Successfully" }, JsonRequestBehavior.AllowGet));
            }
            catch
            {
                return(Json(new { success = false, message = "Save data failed" }, JsonRequestBehavior.AllowGet));
            }
        }
Exemple #4
0
 public ActionResult Create(MahasiswaModel model)
 {
     try
     {
         Mahasiswa = new MahasiswaService();
         bool IsdataExist = Mahasiswa.IsDataExist(model.NPM);
         if (IsdataExist)
         {
             return(Json(new { success = false, message = "Data already exist" }, JsonRequestBehavior.AllowGet));
         }
         Mahasiswa.SimpanMahasiswa(model);
         return(Json(new { success = true, message = "Data Saved Successfully" }, JsonRequestBehavior.AllowGet));
     }
     catch
     {
         return(Json(new { success = false, message = "Data Saved failed" }, JsonRequestBehavior.AllowGet));
     }
 }
Exemple #5
0
 // GET: Mahasiswa/Edit/5
 public ActionResult Edit(string id)
 {
     Mahasiswa           = new MahasiswaService();
     ViewData["jurusan"] = Mahasiswa.GetJurusan();
     return(View(Mahasiswa.GetListMahasiswaById(id)));
 }
Exemple #6
0
 // GET: Mahasiswa/Create
 public ActionResult Create()
 {
     Mahasiswa           = new MahasiswaService();
     ViewData["jurusan"] = Mahasiswa.GetJurusan();
     return(View());
 }