예제 #1
0
        public bool Delete(int cellPositionId, out string strResult)
        {
            strResult = string.Empty;
            bool result = false;
            var  c      = CellPositionRepository.GetQueryable().FirstOrDefault(s => s.ID == cellPositionId);

            if (c != null)
            {
                try
                {
                    CellPositionRepository.Delete(c);
                    CellPositionRepository.SaveChanges();
                    result = true;
                }
                catch (Exception)
                {
                    strResult = "原因:已在使用";
                }
            }
            else
            {
                strResult = "原因:未找到当前需要删除的数据!";
            }
            return(result);
        }
예제 #2
0
        public bool Delete(int cellPositionId)
        {
            var cp = CellPositionRepository.GetQueryable().FirstOrDefault(s => s.ID == cellPositionId);

            if (cp != null)
            {
                CellPositionRepository.Delete(cp);
                CellPositionRepository.SaveChanges();
            }
            else
            {
                return(false);
            }
            return(true);
        }