Exemplo n.º 1
0
 public bool Delete(int id)
 {
     try
     {
         Students entity = _repository.GetById(id);
         _repository.Delete(entity);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
     return(true);
 }
Exemplo n.º 2
0
        public bool Delete(int id)
        {
            bool success = true;

            try
            {
                Subject entity = _repository.GetById(id);
                string  query  = String.Format("DELETE FROM [MediclassDB].[dbo].[Student_Subject] WHERE SubjectId = {0}", id);
                success = _repository.ExecuteQuery(query);
                if (success)
                {
                    _repository.Delete(entity);
                }
                else
                {
                    return(success);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(success);
        }