public void Student_DeleteTest()
        {
            StudentDAO dao             = new StudentDAO();
            int        studentsDeleted = dao.Delete(dao.GetByLastName("Desjardins").Id);

            Assert.True(studentsDeleted != -1);
        }
예제 #2
0
        // Brisanje studenta
        public static void BrisanjePodatakaOStudentu()
        {
            Student st = PronadjiStudenta();

            if (st != null)
            {
                StudentDAO.Delete(Program.conn, st.Id);
            }
        }
예제 #3
0
        public ActionResult Delete(int Id)
        {
            StudentDAO studentDAO = new StudentDAO();

            studentDAO.Delete(Id);

            List <StudentModel> students = studentDAO.FetchAll();

            return(View("Index", students));
        }
예제 #4
0
 public void DeleteStudent(int id)
 {
     if (studentDAO.Delete(id))
     {
         //do not thing
     }
     else
     {
         throw new Exception("Delete Fail!");
     }
 }
 public object Delete(Student info)
 {
     try
     {
         var model = info.Map();
         using (var dao = new StudentDAO())
         {
             return(dao.Delete(model));
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #6
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Sure u wanna delete this student?", "Confirm!", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                Student s = (Student)dataGridViewStudent.CurrentRow.DataBoundItem;
                Account a = AccountDAO.GetAccountByUsername(s.Username);
                Room    r = new Room(s.RoomName, s.Gender, s.BedNo, 0, RoomDAO.getRoomPrice(s.RoomName));
                RoomDAO.Update(r);
                StudentDAO.Delete(s.StuID);
                AccountDAO.Delete(a);
            }
            else
            {
                return;
            }
            LoadData();
        }
예제 #7
0
        public JsonResult Delete(string[] id)
        {
            try
            {
                int[] status = new int[id.Length];

                for (int i = 0; i < id.Length; i++)
                {
                    status[i] = dao.Delete(id[i]);
                }

                return(Json(new
                {
                    status = status
                }));
            }
            catch (Exception)
            {
                return(Json(new
                {
                    status = 0
                }));
            }
        }
예제 #8
0
        public JsonResult Delete(int id)
        {
            var lst = dao.Delete(id);

            return(Json(lst, JsonRequestBehavior.AllowGet));
        }
예제 #9
0
        public void StudentDelete(string no)
        {
            StudentDAO sDAO = new StudentDAO();

            sDAO.Delete(no);
        }
예제 #10
0
        public void DeleteStudent(int id)
        {
            StudentDAO st = new StudentDAO();

            st.Delete(id);
        }
예제 #11
0
 public static bool Delete(Guid id)
 {
     return(StudentDAO.Delete(id));
 }