public void Delete(TypeConsult type)
        {
            var typeDelete = Get(type.Id);
            var typeList   = _context.Schedules.Include(t => t.TypeConsult).AsNoTracking().Where(x => x.TypeConsult.Id == type.Id);

            _context.RemoveRange(typeList);
            _context.Remove(typeDelete);
        }
        public TypeConsult Create(CreateTypeConsultDto type)
        {
            var typeConsultNew = new TypeConsult(0, type.Name, type.Description, type.Enabled);

            if (_repository.TypeConsultExists(typeConsultNew))
            {
                AddNotification("TypeConsult", "Este modo de consulta já está cadastrado");
                return(null);
            }
            if (typeConsultNew.Valid)
            {
                _repository.Save(typeConsultNew);
            }
            return(typeConsultNew);
        }
 public void Update(TypeConsult type)
 {
     _context.Entry(type).State = EntityState.Modified;
 }
 public void Save(TypeConsult type)
 {
     _context.TypesConsult.Add(type);
 }
 public bool TypeConsultExists(TypeConsult type)
 {
     return(_context.TypesConsult.Any(x => x.Name == type.Name));
 }